grenfunday grenfunday - 1 month ago 7
CSS Question

How center unordered list with bullets?

I'm new to web programming and I can't figure out, how to place not only text, but also the unordered list bullets in the center? Here is code:

<div style="text-align:center;">
<h2 style="margin-top:43px;" class="text-center">Important years of life and work:</h2>
<ul >
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
</div>


And here is the pic, to show you what I mean:
enter image description here

Answer

Try this one

div{
  text-align:center;
}ul{
  display:inline-block;
  text-align:left;
}
<div style="text-align:center;">
    <h2 style="margin-top:43px;" class="text-center">Important years of life and work:</h2>
    <ul >
      <li>cat nip</li>
      <li>laser pointers</li>
      <li>lasagna</li>
    </ul>
  </div>