ul {
display: flex;
flex-wrap: wrap;
width: 45%;
height: 40%;
border: 1px solid red;
list-style: none;
margin: 0 auto;
}
ul li {
flex: 1;
}
<ul>
<li><img src="images/yellow.gif" alt="Yellow"></li>
<li><img src="images/orange.gif" alt="Orange"></li>
<li><img src="images/purple.gif" alt="Purple"></li>
<li><img src="images/blue.gif" alt="Blue"> </li>
<li><img src="images/pink.gif" alt="Pink"> </li>
<li><img src="images/green.gif" alt="Green"> </li>
<li><img src="images/black.gif" alt="Black"> </li>
<li><img src="images/gray.gif" alt="Gray"> </li>
<li><img src="images/red.gif" alt="Red"> </li>
</ul>
Actual output
As per the actual output, there is left-margin on inspecting ul
element, as shown below,
there is also right-margin on inspecting li
element, as shown below
Expected output
1) Why these margin space exist?
2) How to avoid these margin space?