Automatic numbering of headers

Discussion in 'HTML' started by Daan, Jul 4, 2003.

  1. Daan

    Daan Guest

    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
     
    Daan, Jul 4, 2003
    #1
    1. Advertising

  2. Daan wrote:

    > 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

    --
    David Dorward http://david.us-lot.org/
    Redesign in progress: http://stone.thecoreworlds.net/
    Microsoft announces IE is dead (so upgrade):
    http://minutillo.com/steve/weblog/2003/5/30/microsoft-announces-ie-is-dead
     
    David Dorward, Jul 4, 2003
    #2
    1. Advertising

  3. In article <be3m7e$8qp$1$>,
    says...
    > Daan wrote:
    >
    > > 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
    >

    Opera's pretty good. Mozilla seems unlikely ever to support them (so
    much for standards compliance):

    http://bugzilla.mozilla.org/show_bug.cgi?id=3247

    Fairly simple example: http://porjes.com/revlist.html
     
    Jacqui or (maybe) Pete, Jul 4, 2003
    #3
  4. Daan

    Daan Guest

    > > 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


    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
     
    Daan, Jul 4, 2003
    #4
  5. Daan

    Chris Harris Guest

    >
    > 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
     
    Chris Harris, Jul 4, 2003
    #5
  6. In article <be3muj$b3i$>, "Daan" <daanstolp @
    newmail . net> wrote:
    > > > 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

    > > 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.


    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.

    --
    Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
    Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
    tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.
     
    Lauri Raittila, Jul 7, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Donovan Martin

    Automatic detection of "dead" headers?

    Donovan Martin, Oct 6, 2004, in forum: C++
    Replies:
    3
    Views:
    406
    A. W. Dunstan
    Oct 6, 2004
  2. dont bother
    Replies:
    0
    Views:
    830
    dont bother
    Mar 3, 2004
  3. Michael Doubez
    Replies:
    1
    Views:
    537
    Peter Flynn
    Jan 27, 2007
  4. Phil
    Replies:
    4
    Views:
    701
    Gabriel Genellina
    Jan 17, 2010
  5. Ian
    Replies:
    2
    Views:
    2,022
Loading...

Share This Page