PDA

View Full Version : can't generate a :before counter


fuper
08-18-2006, 03:50 PM
I'm working through the CSS tutorials at westciv.com and trying things out, but I can't get h[n]:before {content: counter} to generate numbers. (Haven't tried :after, but I assume it's the same.) I've copied and pasted the code (and even compared examples from different sources) without luck: h1:before {content: counter(chapter);
counter-increment: chapter 1
}I can get strings working without difficulty, such as :before {content"some string"}, but my counter generates nothing. I even tried indicating display:marker (though I don't yet know what that means) and display:block, in case that had something to do with it. I'm testing on a Mac with Safari, Firefox, and IE.

cupOfBlue
08-18-2006, 07:09 PM
Try it in the newest beta of Opera. What versions of the different browsers are you using? Though before is a css2 pseudo class I'm not sure it is fully supported yet.

zcorpan
08-18-2006, 07:33 PM
html { counter-reset:chapter; }
h1::before { content:counter(chapter); counter-increment:chapter; }

fuper
08-18-2006, 07:55 PM
Come to think of it, I never meant to spend so much time with it; I was just trying it out and wanted to know whether I was coding incorrectly.

It turns out that I had it right, and it's just not fully supported yet. I tried a couple of the content{} tests in the CSS 2.1 test suite at http://hixie.ch/tests/evil/css/css21/tests/, and only Camino showed them correctly.

Camino 1.0.2
Safari 2.0.4
Firefox v.idunno (it's on my machine at work)
IE 5.2.3 Mac

Thanks for the help.