Last Updated: February 25, 2016
·
3.436K
· apug

Center list items horizontally

If you have an unordered list ul and want center horizontally its items
wrap it with a div styled with display:table and margin:auto and assign display:inline to each li

<div style="display:table;margin: 0 auto">
    <ul>
        <li style="display:inline"> item1 </li> 
        <li style="display:inline"> item2 </li> 
        <li style="display:inline"> item3 </li> 
    </ul>
</div>