I have a list of blocks that I want to center without any margins, like the example below but margin-free.
ul{
margin:0px;
padding:0px
}
.colors{
padding-left: 50px;
padding-right: 50px;
}
.colors li{
display: inline-block;
list-style: none;
height: 8px;
width: 38px;
margin: 0;
padding: 0;
}
.product{
width: 450px;
text-align:center;
box-shadow:0px 0px 15px rgba(0,0,0,.3);
}
<div class="product">
<div class="colors">
<ul>
<li style="background-color:#00ff00;"></li>
<li style="background-color:#0f0f00;"></li>
<li style="background-color:#f00f00;"></li>
<li style="background-color:#00f00f;"></li>
<li style="background-color:#00ff00;"></li>
<li style="background-color:#0f0f00;"></li>
<li style="background-color:#f00f00;"></li>
<li style="background-color:#00f00f;"></li>
<li style="background-color:#00ff00;"></li>
<li style="background-color:#0f0f00;"></li>
<li style="background-color:#f00f00;"></li>
<li style="background-color:#00f00f;"></li>
</ul>
</div>
</div>
Avoid using Javascript and utilize only CSS. Currently, it's set to display:inline-block
, which is causing some unwanted margins.