On May 22, 2008, at 4:41 PM, Jukka K. Korpela wrote:

> Assuming that you want the list items themselves aligned to the left,
> this could by the specs be achieved by using something like the
> following:
>
> ol { list-style-type: none;
>     counter-reset: itemnr; }
> ol li:before {
>     content: counter(itemnr, upper-roman) ".";
>     display: inline-block;
>     width: 1.5em;
>     counter-increment: itemnr; }
>
> That is, you suppress the normal browser-generated list item numbers  
> and
> use generated content to create numbers the way you like. Here the
> essential difference would be that your generated numbers are
> left-aligned, because that's the default for HTML elements, including
> pseudoelements, in general.
>
> And Opera supports this. But most other browsers don't.

Gecko (1.8 and 1.9), Konqueror (3.5), iCab 3 and WebKit (Safari 2+)  
have good support for CSS 2.1 counters - better than Opera, which  
still has problems with the scope of the counter-reset.

With the mark-up above Gecko 1.8 (Fx2) would only have a problem with  
the 'display:inline-block' that it doesn't support (but Gecko 1.9, Fx3  
does). Using the substitute 'display: -moz-inline-box;' won't work in  
this case.

Who knows, it may even work in IE8. During my brief encounter with IE8  
alpha 1, I didn't have time to explore those properties.

For iExploder 6 and 7, one could always let them revert back to more  
default display.

The one issue with the technique above is the width. If you plan to  
have a long lists, 'width: 1.5em' will not be enough.

(and a little bit of margin-right would be a nice touch: 'margin- 
right: .5ex' gives good results)

Test case:
<http://dev.l-c-n.com/_temp/counters.html>


Philippe
---
Philippe Wittenbergh
http://l-c-n.com/





______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to