470,624 Members | 2,276 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

zero-based numbering in ol's?

kj


Hi! How can I achieve zero-based numbering in ordered lists? E.g.
want the list

<ol>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>

to be rendered

0. larry
1. curly
2. moe

instead of the default

1. larry
2. curly
3. moe

Thanks!

kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Dec 6 '06 #1
7 6238
kj wrote on 06 dec 2006 in comp.infosystems.www.authoring.stylesheets:
Hi! How can I achieve zero-based numbering in ordered lists? E.g.
want the list

<ol>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>

to be rendered

0. larry
1. curly
2. moe
IE7 tested:

<ol start='0'>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 6 '06 #2
VK

Evertjan. wrote:
IE7 tested:
That makes it sound as some cutting-edge / presumably non-standard
feature :-)
start attribute is from the initial HTML draft so supported by all
browsers starting from NCSA Mosaic (and even further back).

<http://www.w3.org/TR/html401/struct/lists.html#h-10.2has more
details on it.
<ol start='0'>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>
Dec 6 '06 #3
VK wrote on 06 dec 2006 in comp.infosystems.www.authoring.stylesheets:
Evertjan. wrote:
>IE7 tested:
<ol start='0'>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>

That makes it sound as some cutting-edge / presumably non-standard
feature :-)
Certainly, you could easily have thought that,
but on further thought you should have realized you where wrong.

I just did not test it on another browser.

;-}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 6 '06 #4
Scripsit VK:
start attribute is from the initial HTML draft
No it isn't. It wasn't even in HTML 2.0. It was added in HTML 3.2.
so supported by all
browsers starting from NCSA Mosaic (and even further back).
No, Mosaic didn't support that. Most browsers have supported it from the
start, but there are limitations and flaws in the support.
><ol start='0'>
In particular, the value of '0' has had many problems in browser support,
and so have negative values and large positive values (especially 9999). I
haven't checked the current situation, since I simply don't use such values.

I would have expected someone to mention that this approach is HTML
approach, using deprecated features. On the other hand, there is no CSS way
to deal with the issue, except through generated content and counters, which
have very limited support.

The pragmatic approach:

<ul class="ol">
<li>0. larry</li>
<li>1. curly</li>
<li>2. moe</li>
</ul>

with

ul.ol { list-style-type: none; }

(The reason for using <ulinstead of <olis that we don't want double
numbering when CSS off; numbers preceded by bullets is much better.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 7 '06 #5
Jukka K. Korpela wrote on 07 dec 2006 in
comp.infosystems.www.authoring.stylesheets:
>><ol start='0'>
>
I would have expected someone to mention that this approach is HTML
approach, using deprecated features. On the other hand, there is no
CSS way to deal with the issue, except through generated content and
counters, which have very limited support.
The strange thing, at least in IE7, is:

<ol start='-99999' style='padding-left:100px;'>
<li>larry</li>
<li>john</li>
<li value='-1'>curly</li>
<li value='7'>moe</li>
</ol>

larry and john go fine,
except that without the padding,
part of their numbering is leftishly lost.

curly needs a positive value
or her change is ignored numberwize.

moe is ok.
using deprecated features
As you say, Jukka, there is no alternative but static coding, as yet.

The CSS2 future is bright, MS willing:
<http://www.w3.org/TR/REC-CSS2/generate.html#counters>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 7 '06 #6
"Evertjan." <ex**************@interxnl.netwrites:
Jukka K. Korpela wrote on 07 dec 2006 in
comp.infosystems.www.authoring.stylesheets:
><ol start='0'>

I would have expected someone to mention that this approach is HTML
approach, using deprecated features. On the other hand, there is no
CSS way to deal with the issue, except through generated content and
counters, which have very limited support.

The CSS2 future is bright, MS willing:
<http://www.w3.org/TR/REC-CSS2/generate.html#counters>
Except that if the numbers are important enough to be changed, they're
probably relevant to the content, and so using CSS to generate them
(especially poorly-supported CSS) is probably a bad idea except in
very limited circumstances. The odd behaviour of <ol start=xprobably
rules that out too, which does just leave <ulwith manually-added numbers.

CSS counters have a use in styling XML documents, in known-readership
situations, but probably shouldn't be used in HTML for the web.

--
Chris
Dec 7 '06 #7
kj
In <Xn********************@194.109.133.242"Evertjan ." <ex**************@interxnl.netwrites:
>kj wrote on 06 dec 2006 in comp.infosystems.www.authoring.stylesheets:
>Hi! How can I achieve zero-based numbering in ordered lists? E.g.
want the list

<ol>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>

to be rendered

0. larry
1. curly
2. moe
>IE7 tested:
><ol start='0'>
<li>larry</li>
<li>curly</li>
<li>moe</li>
</ol>

Thanks!

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Dec 7 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Steven T. Hatton | last post: by
28 posts views Thread by Andreas Prilop | last post: by
25 posts views Thread by Mantorok Redgormor | last post: by
15 posts views Thread by Tomás | last post: by
23 posts views Thread by Hallvard B Furuseth | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.