Reputation: 79
I have a ordered list inside a styled div. After styling the enummeratin disappears. What can I do?
HTML
<div class="box">
<ol>
<li>.....</li>
<li>.....</li>
</ol>
</div>
CSS
.box ol{
list-style-type: decimal;
}
.box ol li{
display: block;
margin: 20px 0 10px 0;
}
Upvotes: 0
Views: 89
Reputation: 253318
While you've accepted an answer, it's worth noting that, If you need the list items to be display: block
, then you can (in compliant browsers) also use CSS generated content to restore the list-markers:
.box ol {
counter-reset: listNumber;
}
.box ol li::before {
counter-increment: listNumber;
content: counter(listNumber, decimal);
}
But this approach, while it works, is needlessly complex and has the usual cross-browser issues.
Upvotes: 0
Reputation: 174977
That's because of the display: block;
. If you want to have the bullets (or numbers), don't set display: block
, or do set display: list-item
.
Upvotes: 4