When I use inline-block
, I meet space problem. As many solutions propose here The solution that I liked best is using FlexBox. Just simple, we just add display:flex
in container. As example below:
.flexbox {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
li {
background: slategrey;
display: inline-block;
/* inline block hack for IE 6&7 */
zoom: 1;
*display: inline;
padding: 4px;
color: white
}
<ul class="flexbox">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
My question is: Why FlexBox can prevent extra space of inline-block
. (I know why extra space exist when using inline-block). I have read some documents about FlexBox but no document mentions clearly about relationship between flexbox and inline-block