I have a problem and, although "half solved" (gambiarra), I would like to know what causes it.
I have ul
with white-space: nowrap;
and li
's in display: inline-block;
The problem is that there is still a gap between li
's, even when resetting margin: 0;
, and when I wrap the edges of it to -2px, it is normal. I'd like to know what causes this. Below is the sample code
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.teste {
margin: 20px auto;
white-space: nowrap;
list-style: none;
width: 150px;
height: 90px;
background: blue;
}
.teste>* {
width: 100%;
height: 90px;
background: green;
display: inline-block;
text-align: center;
color: white;
}
/* AQUI, QUANDO EU SETO margin: -2px; AS LI's SE JUNTAM */
.dois>* {
margin: -2px;
}
<ul class="teste" >
<li> Li 1 </li>
<li> Li 2 </li>
<li> Li 3 </li>
</ul>
<ul class="teste dois" >
<li> Li 1 </li>
<li> Li 2 </li>
<li> Li 3 </li>
</ul>