If a select
tag respects the 100% defined in the CSS, then why can't an input
? When inspecting it at the Box Model
in Firefox, I see a padding of 1 and a lateral border of 5.33333!
Why doesn't that border appear around the input? And why is it defined so large as default? What for? I noticed that applying a CSS box-sizing:border-box;
solves the issue, but where is all this specified? I see nothing on MDN.
div {
background-color:green;
width:300px;
height:200px;
}
#txt {
width:100%;
}
#sel {
width:100%;
}
<div>
<p> </p>
<input type='text' id='txt' />
<p> </p>
<select id='sel'>
</select>
</div>