Automatic Numbering Headers

They have: 18 posts

Joined: Jul 2005

I'm having no luck getting automatic numbering to work for

and

on my alternative stylesheet, "Modern." I eventually want every

to read "§A Title", "§B Title", "§C Title" and every

to read "§A1 Subtitle", "§A2 Subtitle" and so on. Here is how I coded it:

div.body_head h4 { counter-reset: section; }
div.body_head h4::before { content: "§" counter(§) " "; counter-increment: § 1; }
div.body_body h5::before { content: "§" counter(§) " "; counter-increment: section; }
'
Here is the website (viewable in Firefox 1.5 only).

Can anyone lend a hand? Thanks in advance.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Well I can get the number working (and incrementing!) in Opera 9 preview with just the code you've supplied. However it doesn't work in Firefox. Sad Have checked the specs and there's nothing wrong there.

Maybe Opera supports this and Firefox doesn't, pretty bleeding edge stuff you're doing here - not that there's anything wrong with that, but even the best browsers (Opera, Safari and Firefox of course) won't support everything immediately. Is there anything on mozilla.org about this? They have quite a good developers section but it only seems to concentrate on Javascript. Sad

The relevant bits about compatibility on Opera can be found at: http://www.opera.com/docs/specs/

Sorry, think you've asked a cutting edge question before that I've been unable to answer! Wish I knew more, but the majority of us are so busy trying to bend that awful Microsoft browser into something that'll display web pages properly that we don't have time to learn up-coming techniques.

Thanks for trying to break the mould, hopefully people like you will encourage others to ditch IE. Oh and I opened it once in IE, and it crashed. Nice.

a Padded Cell our articles site!

They have: 18 posts

Joined: Jul 2005

Another person was able to get at least the

elements to work in Firefox:

div.body_head h4 { counter-increment: section; counter-reset: subsection; }
div.body_head h4::before { content: "§" counter(section, upper-latin) " "; }
div.body_body h5 { counter-increment: subsection; }
div.body_body h5::before { content: "§" counter(section) counter(subsection) " "; }
'

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

I just had a search and found Eric Meyers tests on counter. These do indeed work in Firefox, but he's using lists, whereas you're using h4's. Might be a red herring, but worth a try.

a Padded Cell our articles site!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.