...

View Full Version : Is there a way to get <ol> to start numbering with a number other than 1?



me'
02-27-2004, 05:04 PM
An attribute or CSS property would be great.

coothead
02-27-2004, 05:57 PM
Hi there me',

This is the attribute that will
solve your dilemma ....

<ol start="100">
<li >one</li>
<li >two</li>
<li >three</li>
</ol>

c:D:Dthead

me'
02-27-2004, 06:00 PM
Doesn't seem to exist under xhtml1.1, but it works in Moz. Is it valid?

Roy Sinclair
02-27-2004, 06:27 PM
For valid code use counter-reset. See http://www.w3.org/TR/CSS2/generate.html#counters

liorean
02-27-2004, 06:28 PM
It's valid transitional, but not strict. I'm not sure I agree with the HTML WG about making counters CSS based, though - I consider them semantic and not just presentational, because the may have real, useful meaning.

From the [XHTML1.0 Transitional DTD]:


<!ELEMENT ol (li)+>
<!ATTLIST ol
%attrs;
type %OLStyle; #IMPLIED
compact (compact) #IMPLIED
start %Number; #IMPLIED
>

coothead
02-27-2004, 06:54 PM
Hi there me'

.....or use a little js...

<script type="text/javascript">
<!--
function Order()
{
document.getElementById('ol').start='10';
}
onload=Order;
//-->
</script>

<ol id="ol">
<li >one</li>
<li >two</li>
<li >three</li>
</ol>

c:cool::cool:thead

missing-score
02-27-2004, 08:28 PM
thats ok but isnt very nice to have stuck into the middle of a page. The page then seems not to make sense if the user doesnt have javascript enabled.

me'
02-27-2004, 08:29 PM
Originally posted by missing-score
thats ok but isnt very nice to have stuck into the middle of a page. The page then seems not to make sense if the user doesnt have javascript enabled. Actually not a problem, it's an interface that will only run on my own machine.

missing-score
02-27-2004, 09:26 PM
oh i see, fair doos.

coothead
02-28-2004, 06:52 AM
Hi there missing-score,

thats ok but isnt very nice to have stuck into the middle of a page. The page then seems not to make sense if the user doesnt have javascript enabled....actually the little bit of script would be placed within the head tags.

c:cool::cool:thead

missing-score
02-28-2004, 10:27 AM
whatever lol, i wasnt really meaning where it would be exactly, i doubt the script would be in the exact middle anyways even if it was in the body tag, but what i meant is for a site that the world could visit, it would be better if there was a non js alternative.

brothercake
02-28-2004, 12:01 PM
I'm with liorean on this one - if the numbering system is vital to the meaning of the list, then you should use "list-style-type:none" on a <ul> and then implement the numbering manually.

mindlessLemming
02-28-2004, 12:13 PM
Originally posted by brothercake
I'm with liorean on this one - if the numbering system is vital to the meaning of the list, then you should use "list-style-type:none" on a <ul> and then implement the numbering manually.

++i

It just feels so wrong to number a list using JS. But if it's only for you to view (David), then obviously it's far less crutial.

brothercake
02-28-2004, 06:18 PM
I never said anything about using JS .. I meant manually:


<li>1. blah blah</li>

me'
02-28-2004, 08:36 PM
Well that's semantically incorrect. It's not an unordered list, it's an ordered one. Although that solution applies to <ol> as well.

mindlessLemming
02-29-2004, 12:11 AM
Originally posted by coothead
Hi there me'
.....or use a little js...



Originally posted by brothercake
I never said anything about using JS .. I meant manually:


I never said you did :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum