I have a weird behaviour of an inline-flex
element when applying a clearfix to it. When I set a clearfix to an element which has an inline-flex
display property the strange white space appears before it:
But when the inline-block
is used the behaviour is different:
I don't understand why inline-flex
has a different behaviour than inline-block
.. and why it has that weird space.
.a,
.b {
border: 1px solid red;
}
.a {
text-align: center;
}
.b {
display: inline-flex;
height: 20px;
width: 20px;
}
.cf:before,
.cf:after {
content: " ";
display: table;
}
.cf:after {
clear: both;
}
<div class="a">
<div class="b cf"></div>
</div>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…