Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OL missing numbers

Tags:

html

xhtml

This is going to seem like a stupid question and is basic html but I'm going to ask it anyway. I've seen a few posts that ask this similar question and its not helping fix my issue. I'm working off my local server for testing. I have this for my syntax.

<div id="top5">

            <img src="images/top5.png" alt="Top 5 Rankings" />

            <ol>
                <li class="top5rankings"><a href="roster/kidwonder.php">Kid Wonder</a></li>
                <li class="top5rankings"><a href="roster/kidwonder.php">Kid Wonder</a></li>
                <li class="top5rankings"><a href="roster/kidwonder.php">Kid Wonder</a></li>
                <li class="top5rankings"><a href="roster/kidwonder.php">Kid Wonder</a></li>
                <li class="top5rankings"><a href="roster/kidwonder.php">Kid Wonder</a></li>
            </ol>

        </div>

However it is not putting the numbers for the ordered list and just seeing if anyone can see my problem. This is what I have applied to the rendered page in my css:

li.top5rankings {
color: red;
display: block;
text-align: center;
}

styles.css (line 103)

* {
    margin: 0;
    padding: 0;
    }

styles.css (line 4) Inherited from ol

ol {
    list-style-position: inside;
    list-style-type: decimal;
}
like image 304
Jeff Davidson Avatar asked Oct 21 '25 14:10

Jeff Davidson


1 Answers

If you're using any kind of css-reset stylesheet, it's likely that the list-style-type has been removed, or the margin has been set to 0. Try:

ol {
    margin-left: 2em;
}

ol li {
    list-style-type: decimal-leading-zero;
    list-style-position: outside;
}

JS Fiddle demo

It's also worth noting, as @Fredrik does in his answer, that the display property might be causing problems. For list-elements the default is:

display: list-item;

like image 88
David Thomas Avatar answered Oct 23 '25 03:10

David Thomas