Automatic numbering of headers

D

Daan

Say I have the following document structure:

<h1>First Part</h1>
<h2>First chapter in first part</h2>
<h2>Second chapter</h2>
<h1>Second Part</h1>
<h2>First chapter in second part</h2>
<h3>Paragraph X</h3>
<h3>Paragraph Y</h3>
<h3>Paragraph Z</h3>
<h2>Second chapter</h2>

Is it possible, perhaps using CSS, to automatically append numbering
to these heads, such that the result is:

1 First Part
1.1 First chapter in first part
1.2 Second chapter
2 Second Part
2.1 First chapter in second part
2.1.1 Paragraph X
2.1.2 Paragraph Y
2.1.3 Paragraph Z
2.2 Second chapter

It's not that I really want to apply this on a website, but I am
curious if it is possible with HTML / CSS.

Daan
 
D

David Dorward

Daan said:
Is it possible, perhaps using CSS, to automatically append numbering
to these heads, such that the result is:

1 First Part
1.1 First chapter in first part
1.2 Second chapter
It's not that I really want to apply this on a website, but I am
curious if it is possible with HTML / CSS.

Possible, but very very very badly supported (Mozilla and IE don't support
it, I haven't tested with Opera or Safari).

http://www.w3.org/TR/CSS2/syndata.html#counter
 
D

Daan

Is it possible, perhaps using CSS, to automatically append
numbering
Possible, but very very very badly supported (Mozilla and IE don't support
it, I haven't tested with Opera or Safari).

http://www.w3.org/TR/CSS2/syndata.html#counter

Hm, it looks like Opera 7 has some sort of an implementation for it,
but I can't really get it to work like I wanted to. Not that it really
matters, I can just use Word of Latex to get the effect, but I was
just curious.

Daan
 
C

Chris Harris

1 First Part
1.1 First chapter in first part
1.2 Second chapter
2 Second Part
2.1 First chapter in second part
2.1.1 Paragraph X
2.1.2 Paragraph Y
2.1.3 Paragraph Z
2.2 Second chapter

It's not that I really want to apply this on a website, but I am
curious if it is possible with HTML / CSS.

Ordered lists should do it
 
L

Lauri Raittila

"Daan" <daanstolp @ said:
Hm, it looks like Opera 7 has some sort of an implementation for it,
but I can't really get it to work like I wanted to.

Some of Opera 7.x have broken support for counters, 7.2b1 seems to handle
them correctly. Opera versions 5 and 6 are also fine.

In action:
http://www.student.oulu.fi/~laurirai/muuta/koulujutut/kalifornia.html
(250kB+ of Finnish text and images)
http://www.student.oulu.fi/~laurirai/muuta/koulujutut/kalifornia.css

The index have generated numbers, the rest doesn't.

Should degrade nicely, but haven't tested troughly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top