By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

Using CSS to set start number in an ordered list

P: n/a
I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.

In HTML after the first couple of months I just use this sort of code:
<ol start="14" type="1"and go on.

I see that the "start" attribute is deprecated in HTML 4.01. I don't
know what to plug into my css stylesheet to get an ordered list to
start at a number I designate. Any suggestions?
Sep 12 '08 #1
Share this Question
Share on Google+
16 Replies


P: n/a
On Fri, 12 Sep 2008, some old html fumbler wrote:
In HTML after the first couple of months I just use this sort of code:
<ol start="14" type="1"and go on.
Any suggestions?
Use "HTML 4.01 Transitional" and keep the START attribute.

--
In memoriam Alan J. Flavell
http://www.alanflavell.org.uk/charset/
Sep 12 '08 #2

P: n/a
On Sep 12, 9:38*am, some old html fumbler <fumb...@nospam.invalid>
wrote:
I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.

In HTML after the first couple of months I just use this sort of code:
<ol start="14" type="1"and go on.

I see that the "start" attribute is deprecated in HTML 4.01. I don't
know what to plug into my css stylesheet to get an ordered list to
start at a number I designate. Any suggestions?
You could also set a class to {display: none} in the CSS and include
the obsolete lines in this class. I think this would work. Anyone
know for sure?
Sep 12 '08 #3

P: n/a
Helpful person wrote:
On Sep 12, 9:38 am, some old html fumbler <fumb...@nospam.invalid>
wrote:
>I see that the "start" attribute is deprecated in HTML 4.01. I don't
know what to plug into my css stylesheet to get an ordered list to
start at a number I designate. Any suggestions?

You could also set a class to {display: none} in the CSS and include
the obsolete lines in this class. I think this would work. Anyone
know for sure?
Huh?

Are you suggesting using 'display: none' to "hide" the deprecated
attributes 'start="14" type="1"'? Then no, absolutely not, it would just
prevent the OL from displaying altogether.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Sep 12 '08 #4

P: n/a
On Fri, 12 Sep 2008 10:53:10 -0400, "Jonathan N. Little"
>....
<ol start="14">
<li>If you want IE support and live with the deprecated attribute</li>
<li>Fee</li>
<li>Fie</li>
<li>Foe</li>
<li>Fum</li>
</ol>

</body>
</html>
Oh, IE won't even see it if I were to do accomplish it in CSS then?

*SIGH* I guess those pages just are never going to validate as HTML
4.01 strict then. I may as well just leave it transitional. Thanks.

And yet the "start" attribute is back for HTML 5.0 from what I see!
What a world.
Sep 12 '08 #5

P: n/a
some old html fumbler wrote:
On Fri, 12 Sep 2008 10:53:10 -0400, "Jonathan N. Little"
>....
<ol start="14">
<li>If you want IE support and live with the deprecated attribute</li>
<li>Fee</li>
<li>Fie</li>
<li>Foe</li>
<li>Fum</li>
</ol>

</body>
</html>

Oh, IE won't even see it if I were to do accomplish it in CSS then?

*SIGH* I guess those pages just are never going to validate as HTML
4.01 strict then. I may as well just leave it transitional. Thanks.
No, just keep DOCTYPE 4.01 Strict. USing a deprecated attribute will not
prevent your page from displaying...don't fret about it.
And yet the "start" attribute is back for HTML 5.0 from what I see!
What a world.
HTML5.0 is still pie-in-the-sky and some of the suggestions I are far
from useful IMHO. But hey, cheer up, maybe MS can get IE to support the
10-year-old standard with version 8 or 9 or 10... ;-)
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Sep 12 '08 #6

P: n/a
On Sep 12, 1:58*pm, "Jonathan N. Little" <lws4...@central.netwrote:
Helpful person wrote:
On Sep 12, 9:38 am, some old html fumbler <fumb...@nospam.invalid>
wrote:
I see that the "start" attribute is deprecated in HTML 4.01. I don't
know what to plug into my css stylesheet to get an ordered list to
start at a number I designate. Any suggestions?
You could also set a class to *{display: none} in the CSS and include
the obsolete lines in this class. *I think this would work. *Anyone
know for sure?

Huh?

Are you suggesting using 'display: none' to "hide" the deprecated
attributes 'start="14" type="1"'? Then no, absolutely not, it would just
prevent the OL from displaying altogether.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com
No. I'm suggesting adding the class only to the items not wanted.
The main question I have is: Will the browser still use the non
displayed items to incement the numbers? (Or will it just count the
displayed items?)
Sep 12 '08 #7

P: n/a
On 2008-09-12, Helpful person wrote:
On Sep 12, 9:38*am, some old html fumbler <fumb...@nospam.invalid>
wrote:
>I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.

In HTML after the first couple of months I just use this sort of code:
<ol start="14" type="1"and go on.

I see that the "start" attribute is deprecated in HTML 4.01. I don't
know what to plug into my css stylesheet to get an ordered list to
start at a number I designate. Any suggestions?

You could also set a class to {display: none} in the CSS and include
the obsolete lines in this class. I think this would work. Anyone
know for sure?
It wouldn't work if CSS was turned off or if the browser didn't
support CSS.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Sep 12 '08 #8

P: n/a
In article <uk********************************@4ax.com>,
some old html fumbler <fu*****@nospam.invalidwrote:
I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.
So do the most straightforward thing you can do in this situation and
use simple HTML and simple CSS that is cross browser and cross earthling
win-win. Use a two column table in which the column on the left holds
the numbers. In fact why would you be wanting to have numbers when you
can have the date itself and be utterly clear?

--
dorayme
Sep 12 '08 #9

P: n/a
On Sat, 13 Sep 2008 07:29:34 +1000, dorayme
<do************@optusnet.com.auwrote:
>In article <uk********************************@4ax.com>,
some old html fumbler <fu*****@nospam.invalidwrote:
>I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.

So do the most straightforward thing you can do in this situation and
use simple HTML and simple CSS that is cross browser and cross earthling
win-win. Use a two column table in which the column on the left holds
the numbers. In fact why would you be wanting to have numbers when you
can have the date itself and be utterly clear?
I have both the date and the number of the item. The number of the
item is relevant and needs to be part of the list. I'm just going to
leave it all as a transitional doctype.

I find it bizarre that they took this out for 4.01 and have it back in
again for 5.0.
Sep 13 '08 #10

P: n/a
Chris F.A. Johnson wrote:
On 2008-09-12, Helpful person wrote:
>On Sep 12, 9:38 am, some old html fumbler <fumb...@nospam.invalid>
wrote:
>>I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.

In HTML after the first couple of months I just use this sort of code:
<ol start="14" type="1"and go on.

I see that the "start" attribute is deprecated in HTML 4.01. I don't
know what to plug into my css stylesheet to get an ordered list to
start at a number I designate. Any suggestions?
You could also set a class to {display: none} in the CSS and include
the obsolete lines in this class. I think this would work. Anyone
know for sure?

It wouldn't work if CSS was turned off or if the browser didn't
support CSS.
True, but what percentage of users have CSS turned off or are using a
browser that doesn't support it? Statistically, I'm guessing it's
effectively zero.

--
Ed Mullen
http://edmullen.net
I always take life with a grain of salt, plus a slice of lemon and a
shot of tequila.
Sep 13 '08 #11

P: n/a
In article <ok********************************@4ax.com>,
some old html fumbler <fu*****@nospam.invalidwrote:
On Sat, 13 Sep 2008 07:29:34 +1000, dorayme
<do************@optusnet.com.auwrote:
In article <uk********************************@4ax.com>,
some old html fumbler <fu*****@nospam.invalidwrote:
I want to use CSS to get an ordered list to start with something other
than a 1 or equivalent.

I have a list of things that happen during the course of a year. Too
long a list is not helpful, so I only show maybe 3 months of items at
a time. The items have to be ordered according to the year, IOW I
can't list something in April as being #1.
So do the most straightforward thing you can do in this situation and
use simple HTML and simple CSS that is cross browser and cross earthling
win-win. Use a two column table in which the column on the left holds
the numbers. In fact why would you be wanting to have numbers when you
can have the date itself and be utterly clear?

I have both the date and the number of the item. The number of the
item is relevant and needs to be part of the list. I'm just going to
leave it all as a transitional doctype.
I am puzzled as to how this is quite relevant to what I said? There is
even more reason to use a table then, you have a number and you have a
date and you have something that is supposed to happen or has happened
on that date. This suggests a three col table to me.

Take with a large grain of salt any voice inside you that says if a list
has numbers, and if it is ordered, then you must use an OL. It is not
true at all and you don't must do anything of the kind.

You have some information to convey. Convey it with the appropriate
tool, which is one that does not give you or anyone else grief. In this
case a table is an excellent tool and it will convey what you want and
it will be rock solid cross browser.

--
dorayme
Sep 13 '08 #12

P: n/a
Ed Mullen wrote:
> It wouldn't work if CSS was turned off or if the browser didn't
support CSS.

True, but what percentage of users have CSS turned off or are using a
browser that doesn't support it? Statistically, I'm guessing it's
effectively zero.
Factually, you are just making pointless guesses. Never depend on a guess
when you don't need to.

Quite a few pages are either unusable or awful when viewed "as the author
intended", with some crappy CSS code, and turn rather useful when CSS is
switched off. In fact, if you are looking for useful content, switching CSS
is often a good idea.

Besides, _anything_ in CSS code may be overridden by user style sheets,
ignored due to browser bugs, or just null and void since it does not apply
(e.g., color settings on Braille presentation).

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Sep 13 '08 #13

P: n/a
Ed Mullen wrote:
Chris F.A. Johnson wrote:
>On 2008-09-12, Helpful person wrote:
>>You could also set a class to {display: none} in the CSS and include
the obsolete lines in this class. I think this would work. Anyone
know for sure?

It wouldn't work if CSS was turned off or if the browser didn't
support CSS.

True, but what percentage of users have CSS turned off or are using a
browser that doesn't support it? Statistically, I'm guessing it's
effectively zero.
Doesn't matter since the suggestion of hiding the "extra" LIs does not
work. The first displayed LI will be *1*...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Sep 13 '08 #14

P: n/a
some old html fumbler wrote:
I have both the date and the number of the item. The number of the
item is relevant and needs to be part of the list. I'm just going to
leave it all as a transitional doctype.
As I said earlier, if this is a new page then use strict. Don't change
your doctype just because you have one error, and a very minor on at
that. It is not that you page will refuse to display or blow up! All
your doing is using a deprecated attribute which means is *may* not be
supported in future browsers, but in practice it hasn't happened, except
for NN's layer, but look embed is still supported.
>
I find it bizarre that they took this out for 4.01 and have it back in
again for 5.0.
Again, 5.0 is still a pipe dream, I hazard a guess that the only reason
its return is being considered is due to MSIE's piss-poor CSS support.
Maybe MS will finally step up to the plate, or better yet die a
beautiful death...buried by other better options of Firefox, Opera,
Safari, Chrome and other to follow!
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Sep 13 '08 #15

P: n/a
Sat, 13 Sep 2008 06:55:25 GMT from some old html fumbler
<fu*****@nospam.invalid>:
I have both the date and the number of the item. The number of the
item is relevant and needs to be part of the list.
Then it should not be dependent on CSS, which is for presentational
aspects only.

If the numbers of the items matter, I believe you should include them
in your source file.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Sep 14 '08 #16

P: n/a
On 13 Sep, 14:48, "Jonathan N. Little" <lws4...@central.netwrote:
some old html fumbler wrote:
I have both the date and the number of the item. The number of the
item is relevant and needs to be part of the list. I'm just going to
leave it all as a transitional doctype.

As I said earlier, if this is a new page then use strict. Don't change
your doctype just because you have one error, and a very minor on at
that. It is not that you page will refuse to display or blow up!
That's true, doctype don't mean that much, but the difference between
'standards mode' and 'almost standards mode' is marginal. The main
difference is how layout with sliced images is aligned within table
cells.

There are some few other differences, e.g.:
http://www.tidraso.co.uk/misc/quirks-mode/

There might be a few others, but it won't make much difference if you
use HTML 4.01 Strict, instead of HTML 4.01 Transitional. IE 6
and IE 7 are using 'almost standards mode' anyway. And if you want it
to work in those browsers, I can't see why a strict doctype is
better than an transitional doctype. You're using the 'start'
attribute as an transition to the 'counter-reset' property, aren't
you?
All
your doing is using a deprecated attribute which means is *may* not be
supported in future browsers, but in practice it hasn't happened, except
for NN's layer, but look embed is still supported.
If you're using an Transitional doctype the 'start' attribute is in
the specification, so that attribute will be supported as long as that
doctype
is supported. The NN's layer isn't in HTML 4.01.

By using the strict doctype, and ignoring the doctype declaration, you
could as well use '<!DOCTYPE html>. Even IE 6, supports that.

You could of course use HTML 4.01 Strict and both 'counter-reset' and
the deprecated attribute 'start'. That would work, even if the browser
don't recognize the 'start' attribute.
I find it bizarre that they took this out for 4.01 and have it back in
again for 5.0.
Not much more of a dream than your own dream. In fact, you're dreaming
the same thing, when you say that the 'start' attribute "*may* not be
supported in future browsers, but in practice it hasn't happened".
Again, 5.0 is still a pipe dream, I hazard a guess that the only reason
its return is being considered is due to MSIE's piss-poor CSS support.
Maybe MS will finally step up to the plate, or better yet die a
beautiful death...buried by other better options of Firefox, Opera,
Safari, Chrome and other to follow!
I can't argue with that.
Sep 14 '08 #17

This discussion thread is closed

Replies have been disabled for this discussion.