Why I cannot use display:table-row; with list-style-type:decimal; ?
my CSS file:
ol {
list-style-type: decimal;
}
li {
background-color: red;
display: table-row;
}
my HTML file:
<ol>
<li>This is the first.</li>
<li>This is the second.</li>
</ol>
Goal: I just want to display the numbers leading each line, with all <li> as long as the longest item.
Because
list-style-typeonly works withdisplay:list-item. :/Per the specification:
Edit Based on new information in your comments, you can do this on modern browsers:
http://jsfiddle.net/XMrbu/12/
Or what about this:
http://jsfiddle.net/XMrbu/14/
If you make the
olbedisplay:inline-block(orfloatit) it will automatically collapse to the width of the longest item inside. You can then style theolorlias you like to that width.