how to center an ordered list in html code example

Example 1: how do i move the numbers of an ordered list centered with css

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>align</title>
  <style>
    li {list-style-position: inside;}
  </style>
</head>
<body>
<ol>
  <li style="text-align: left">item 1</li>
  <li style="text-align: center">item 2</li>
  <li style="text-align: right">item 3</li>
</ol>
</body>
</html>

Example 2: how to center an ordered list in html

CSS

.center
{
 text-align: center;
 list-style-position: inside;
}
ol.center li
{
 text-align: left;
 margin-left: 45%;
}

HTML

<ol class="center">Lorem ipsum dolor sit amet consectetur adipisicing elit. Reprehenderit, repellat.
<li>List1<li>
<li>List2<li>
</ol>

Tags:

Misc Example