fbpx
Posted inCSS

CSS: Center-Align List with Left-Aligned Text (and Unknown Width)

CSS Code:

div.parent { text-align: center; } ul { display: inline-block; text-align: left; }

 

HTML:

<div class="parent"> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> </div>

Leave a Reply

36  −  29  =