I've got the follow HTML code:
<section class="container">
<div class="search"></div>
</section>
And these CSS rules:
*, *:before, *:after {
box-sizing: border-box;
}
body, section, div {
margin: 0;
padding: 0;
}
html, body { height: 100%; }
.container {
display: inline-block;
position: relative;
}
.search {
display: inline-block;
padding: 3em;
border: 1px solid black;
}
If you inspect the section
element, you'll see that it has 5px of size... I didn't establish the size. I leave that the browser calculates this automatically with the child's size.
Why this behavior?