Forum How do I...?

Counter reset within a table

opochon
Dear Mike,

I would like to reset a counter within a table or a div, because, for coherence, my content is nested :
<table><tr><td>
<h1>Title 1</h1>
Content 1
<table><tr><td>
<h2>Title 2</h2>
Content 2
</td></tr></table>
</td></tr></table>
[..]
(Second, i processed the same with <div> instead of the tag. The same occured)
Is there a way to reset the counter liked with the h2 tag ? (I remember you told me this was not possible when the counter was linked with the table class, as i was doing before)

Thank you for any help.
Best regards,

Olivier
mikeday
A simple rule like this should do it:
h2 { counter-reset: foo 1 }

Is the counter failing to reset when the h2 is inside a table? This may be a bug if so.
opochon
I wish it works. That's what is use :
.HOBJECT1 {
	counter-increment: h1cnt;
	counter-reset: h2cnt h3cnt h4cnt h5cnt ;	
}

.HOBJECT1 {
	counter-increment: h1cnt;
	counter-reset: h2cnt 1;	
}


If you remember, we already discussed this point, your answer was (email from the 23 july 07)
However, the reason the section counter is not being reset is actually because each h1 element is within a table, and the scope of the counter-reset does not go beyond the table that the heading is in. Can you take the headings out of the tables?


What i've done. But now, i really need it inside tables or div.

Anyway, since this, i generate numbering before using Prince.