Hello, I am trying to get numberings for some headings, but for some reason it does not work. I am using this css code:
body { counter-reset: h2counter; } h1 { counter-reset: h2counter; } h2:before { content: counter(h2counter) ".\0000a0\0000a0"; counter-increment: h2counter; counter-reset: h3counter; } h3:before { content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0"; counter-increment: h3counter; }
Unfortunately, it works only on first level, then it looses ability to count properly.
So the results looks like:
T 1.
T 2.
T 2.1
T 2.1.
T 2.0.1
T 3.
It simply reset counters too early. Anyway I was trying the code somewhere else, and code is OK, the problem might be in proper CSS selectors? Could anyone give me a hand? Thanks.
Any idea someone? I was trying to find the solution on this website, but it seems that I am not the first one nor last one. My though was that the whole Confluence documentation is a tree structure which is converted to <Hx> tags. Unfortunately it seems, that only few first headings are taken in consideration. Next ones are not numbered validly. The numbering usually starts from 0 again - because there is some kind of inconsistency in generating process.
Thanks for the reply. I checked it, and I think that I found the problem somewhere else.
body {counter-reset: h1counter;} h1 {counter-reset: h2counter;} h2 { counter-reset: h3counter; } h3 { counter-reset: h4counter;} h1: before { content: counter(h1counter) '. '; counter-increment: h1counter;} h2:before { content: counter(h1counter) '.'counter(h2counter) ".\0000a0\0000a0"; counter-increment: h2counter; } h3:before { content: counter(h1counter) '.'counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0"; counter-increment: h3counter; } h4:before { content:counter(h1counter) '.' counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0"; counter-increment: h4counter;
<h1>H1</h1> <h2>H2</h2> <h2>H2</h2> <h1>H1</h1> <h4>H4</h4> <h2>H2</h2> <h3>H3</h3><h3>H3</h3><h3>H3</h3> <h4>H4</h4><h4>H4</h4><h4>H4</h4> <h1>H1</h1> <h2>H2</h2>
So, this example works just fine. The problem in the example is <h4>. And I think that this is exactly happening in my Confluence. For some reason, There are missing headings, and therefore It is not able to generate headings properly. Although there is clear tree structure - with approx. 7 levels of headings. Do you have any idea where could be a problem regarding generated structure? I think that problem is definitively in the structure itself, css is not the problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The CSS code looks correct. And yes, if headings are missing, the numbering will be mixed up as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, and do you have any idea how to fix the problem with missing headings? I thought, the tree hierarchy of whole Confluence is converted into <Hx> tags depends on the depth in the structure. But it seems it is not generating headings at all. Do you have any clue how to fix it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think your counter-reset: h3counter; needs to be in the h2 clause, not in the h2:before clause.
Like this:
h2 { counter-reset: h3counter; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.