Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centering <UL> + Keeping <LI>'s Aligned

Tags:

html

css

My problem: http://i56.tinypic.com/ff3jmo.png

The bullet points aren't aligned.

All I'm going is text-align:center'ing the class in which the ul resides. Can I align the bullet points?

EDIT: I just want to try and clarify. I want the actual bullet points aligned. Currently the text is aligned, but not the bullet points.

  • T e x t
    • T e x t
      • T e x t

Where as I want

  • Text
  • Text
  • Text
  • (Bullet points aligned, text centered)
like image 284
CenterMe Avatar asked May 07 '26 22:05

CenterMe


1 Answers

text-align: center isn't to be used for this purpose. You should probably put the <ul> in a <div> and center that by setting it to a certain width and using margin-left: auto; and margin-right: auto.

So:

<div style="width: 25%; margin-left: auto; margin-right: auto;">
    <ul>
        <li>List item 1</li>
        <li>List item 2</li>
    </ul>
</div>
like image 151
asthasr Avatar answered May 11 '26 15:05

asthasr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!