473,320 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 6327
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steven T. Hatton | last post by:
I mistakenly set this to the comp.std.c++ a few days back. I don't believe it passed the moderator's veto - and I did not expect or desire anything different. But the question remains: ISO/IEC...
28
by: Andreas Prilop | last post by:
Jukka reports on http://www.cs.tut.fi/~jkorpela/chars/spaces.html that Internet Explorer 6 fails on the "zero width space" U+200B ​ Is this observation still valid? For which versions of MS...
15
by: I wish | last post by:
#include <string.h> int a; memset( a, 0, sizeof(a) ); Does that guarantee all bits zero? -- |
25
by: Mantorok Redgormor | last post by:
Finally, control is returned to the host environment. If the value of status is zero or EXIT_SUCCESS, an implementation-defined form of the status successful termination is returned. beyond this...
53
by: Zhiqiang Ye | last post by:
Hi, All I am reading FAQ of this group. I have a question about this: http://www.eskimo.com/~scs/C-faq/q7.31.html It says: " p = malloc(m * n); memset(p, 0, m * n); The zero fill is...
25
by: pm940 | last post by:
Hello. I've been reading some past discussions on the NULL vs. zero. References are always made to systems or machienes that use values other than zero to represent the NULL pointer. Although...
10
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp "If the value of the variant argument is Null, the Nz function returns the number zero or a...
15
by: Tomás | last post by:
Is the following fully legal and fully portable for all the unsigned types? The aim of the function is to take an array by reference and set each element's value to zero. #include <... ...
4
by: H.S. | last post by:
Hello, I am trying out a few methods with which to test of a given number is practically zero. as an example, does the following test correctly if a given number is zero within machine...
23
by: Hallvard B Furuseth | last post by:
As far as I can tell, (x & -1) is nonzero if the integer x is negative zero. So for signed types, x == 0 does not guarantee (x & foo) == 0. Is that right? (Not that I expect to ever encounter a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.