Nikolas Nikolas - 3 months ago 10
HTML Question

How to center ordered list number in HTML

I am currently learning HTML programming. I have a problem:

If I put like this:

<html>
<body align="middle">
HEADLINE
<ol>
<li>First Item</li>
</ol>
</body>
</html>


The problem is the number (1.) is on the left when I wanted it to be aligned under the headline. How can I get the whole list item to the middle?

I need atleast 10 reputation to add pictures so I'll provide a link to another website for you to see the picture: ALIGNING

Answer

You are aligning texts in the body.

Try this:

<html>
<body>

<h4 align="center">HEADLINE</h4>
    <ol class="center">
    <li>First Item</li>
    </ol>

<style type="text/css">
 .center { text-align: center; list-style-position:inside;}
</style>

</body>
</html>

Hope this helps !