I thought that I could do the following:
<ol style = "type:numeric; glyphs: '0' '1';">
<li> Item 0 </li>
<li> Item 1 </li>
<li> Item 2 </li>
</ol>
to produce a list that counted in binary. That is, the above example should have produced:
0. Item 0
1. Item 1
10. Item 2
But alas, it did no such thing. Firefox just ignored my style suggestions.
I was reading about this on http://www.w3.org/TR/css3-lists/ (section 8.1.2)
But clearly I've misread / misunderstood the specification. Any help?
Thank you!
The <ol> HTML element represents an ordered list of items — typically rendered as a numbered list.
Using HTML, you can create two kinds of lists unordered list and ordered list. An ordered list is marked with the numbers by default. You can create an ordered list using the <ol></ol> tag and, define the list items using <li></li>. type="1"− This creates a numbered list starting from 1.
The ol element is used when the list is ordered and the ul element is used when the list is unordered. Definition lists ( dl ) are used to group terms with their definitions. Although the use of this markup can make lists more readable, not all lists need markup.
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
If you want to do it visible in every browser, you need to do it with another language (javascript/jquery, or with something comming from your server)
In the end, you just need to have something like that : http://jsfiddle.net/KdhxX/
<ol>
<li value="0"> Item 0 </li>
<li value="1"> Item 1 </li>
<li value="10"> Item 2 </li>
</ol>
with the value inserted inside your "li" populated by javascript, or your server-side language
The type
and glyphs
properties go in side a @counter-style
declaration, so you need to define counter style then use it.
@counter-style mybinary {
type: numeric;
glyphs: '0' '1' '2';
}
<ol style = "list-style-type:mybinary;">
<li> Item 0 </li>
<li> Item 1 </li>
<li> Item 2 </li>
</ol>
I don't think any browser implements this though as this is all I found on it besides the working draft and this line from MDN
CSS Lists and Counters Module Level 3 Working Draft Adds support for and adds identifiers used in @counter-style rules to keywords. These changes are not yet reflected on this page as no browser currently implements them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With