Example: https://codepen.io/229075284/pen/aboQVXZ
.outer{
background-color: pink;
}
.outer::after{
content:'';
background-color: red;
display: inline-block;
font-size: 0;
line-height: 0;
overflow: hidden;
height: 0;
/* display: table; */
}
.inner{
background-color: blue;
height: 300px;
}
<div class="outer">
<div class="inner"></div>
</div>
When I set display
of outer::after
to inline-block
,the outer will have some extra space marked as pink, even if set font-size
and line-height
to 0
. However, when I set display
to table
,the extra space disappears.
So I am wondering why the extra space appears?