Reputation: 29
I tried many solution from stackoverflow to center my <UL>
with no success. Can anyone check it?
I want to center "Shop 943 01 ... not available".
Thanks
Upvotes: 0
Views: 800
Reputation: 13545
HTML :
<div class="div">
<ul>
<li>Test 1</li>
<li>Test 2</li>
<li>Test 3</li>
</ul>
</div>
CSS :
.div {
text-align: center;
}
.div ul {
margin: 0 auto;
}
.div ul li {
width: 100px;
display: inline-block;
}
Upvotes: 5
Reputation: 6696
If you set a fixed width on the ul you can use auto
as value for the horizontal margin to center the ul.
ul {
margin: 0 auto;
width: 200px;
}
Upvotes: 1