0

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

mplungjan
  • 155,085
  • 27
  • 166
  • 222
grenfunday
  • 111
  • 3
  • 11
  • 1
    Possible duplicate of [Bullets center with unordered list](http://stackoverflow.com/questions/6550069/bullets-center-with-unordered-list) – mplungjan Nov 07 '16 at 13:51

2 Answers2

2

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>
Prasath V
  • 1,314
  • 4
  • 18
  • 34
0

h2{
  text-align:center;
  margin-top:43px;
}
 ul {
    display: inline-block;
    text-align: left;
    padding: 0;
}
   <div style="text-align:center;">
    <h2>Important years of life and work:</h2>
    <ul >
      <li>cat nip</li>
      <li>laser pointers</li>
      <li>lasagna</li>
    </ul>
  </div>
Razia sultana
  • 2,051
  • 3
  • 13
  • 20