View Full Version : setting start value in OL using css

Vijay Venkat
02-05-2005, 05:29 AM
We can set the start value for lists using HTML as shown below.

Eg here the list starts with value like:
10. Start from 10

<OL start="10">
<LI> Start from 10

Is there a way to set this 'start' value using CSS?

Vijay Venaktaraman

02-05-2005, 05:37 AM
I don't think so... at least, I spent days looking for a css replacement to "<li value="x">" with no luck...

Vijay Venkat
02-07-2005, 07:45 AM

Thanks for the information. Very weird, that we cannot set it using CSS. I have live with HTML Tweaks.

Vijay Venkataraman

02-07-2005, 06:38 PM
If the numbering is important to the meaning of the list, and wide browser support is important - I'd use a <ul>, style away the bullet and then write in the numbers manually - because you can't know with complete certainty how <ol> numbering will actually come out.

Alternatively - if you're in a mood to experiment (if it only has to work in mozilla / opera), you can do some very funky stuff with generated content (http://www.w3.org/TR/CSS21/generate.html#before-after-content) and automatic counters (http://www.w3.org/TR/CSS21/generate.html#counters)

02-07-2005, 09:39 PM
This doesn't seem to validate even though it's in the spec
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<li value="10">Item 1</li>
<li>Item 2</li>
<li>Item 3</li>

Vijay Venkat
02-08-2005, 06:56 AM
Brothercake - Thanks for the links. They are really worth investigating
hemebond - what you have pointed to is HTML controlled and not CSS controlled. Thanks for taking time to explain.

Thanks once againg to everyone.

Vijay Venkataraman

02-08-2005, 08:15 AM
There has just been a good discussion on this on the WSG (http://webstandardsgroup.org/) mailing list

Here's the archive of that thread: http://www.mail-archive.com/wsg%40webstandardsgroup.org/msg14074.html

02-08-2005, 09:16 AM
Great link, thanks Andrew...

Personally, I'm siding with the guys who say don't worry about the specs on this one. I can think of several reasons to break up the start value or the list value of an ordered list, and as far as I'm concerned, it's a matter of content, not presentation.

If the only out of spec part of your code is a warning from the validator about <ol start="">, then it seems you (the royal you, not you specifically, Vijay :)) are coding just to satisfy the inner webnerd and not for real life advantages or needs. In other words, the letter and not the spirit of standards.