In the following HTML code:
<div>
<label id="name-label">
NOMBRE
<input type="text" id="username" name="username" placeholder="Introduce tu nombre" required>
</label>
</div>
By applying the following CSS
div{
border: 2px solid orange;
}
label{
background-color: blue;
display: block;
}
input{
width: 100%;
}
The input element occupies more space than the label element that contains it.
Why does this happen? If 100% refers to the parent, which in this case is the label element... it could never take up more space, could it?
How could I solve it. Thank you very much.