Forum Moderators: open
you can cheat with javascript but, of course, it will not work for those who have it disabled. :(
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>start at eight</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<script type="text/javascript">
//<![CDATA[
function getRound() {
document.getElementById("start").start=8;
}
onload=getRound;
//]]>
</script>
</head>
<body><ol id="start">
<li> Starting from 8</li>
<li> This should be nine!</li>
</ol></body>
</html>
birdbrain
Just as I thought...
Maybe they want us to use css counters instead:
[w3.org...]
But I doubt they are supported by most browsers.
Furthermore, using CSS to control list numbering seems like a misuse in the first place. CSS is about presentation, not semantics. Your markup is supposed to supply the semantic meaning of the document, and the number a list starts with is definitely within this realm. It's not presentational; the number has as definite a purpose as a paragraph or a heading.
I'm heart and soul behind CSS for the most part, but sometimes the good old attributes are still the way to go. I consider this one of those cases.
Details about number order. In ordered lists, it is not possible to continue list numbering automatically from a previous list or to hide numbering of some list items. However, authors can reset the number of a list item by setting its value attribute. Numbering continues from the new value for subsequent list items. For example:
<ol>
<li value="30"> makes this list item number 30.
<li value="40"> makes this list item number 40.
<li> makes this list item number 41.
</ol>
Here is the URL with information on list ordering. Scroll down about midway and you will find the information I mentioned above: [w3.org...]
It does work, too!
<ol>
<li value="30"> makes this list item number 30.
<li value="40"> makes this list item number 40.
<li> makes this list item number 41.
</ol>
I just tested this out, and it works in all of these:
However, there's a catch...it doesn't validate Strict for HTML 4.01 or XHTML for which the "type" and "value" attributes were depreciated on the <li> element. So, if you're using a Transitional doctype then you could use this or just stick with the old
<ol start="8">, which will still validate.