When Im clicking the links in table of contents it moves the page so the header it referred to is placed at the top of the screen. For me it needs to be placed X px down from the top. How can i achieve this?
Ive made a tiny illustration to show what it does now and what i want it to do.
I managed to fix this by adding some css to h2 tags in these pages. Because we are using the same naming convention it makes it easy to just style the h2 tags in the right pages.
h1[id*="2019."]{
padding-top: 70px !important;
margin-top-30px !Important;
}
Hello, @Halvard Meijer !
As I understand, you need to customize where the automatic page scrolling of our Table of Contents macro stops after you click the link.
Is that correct?
If the above is correct, I can tell you that this is not currently possible. The Table of Contents macro relies on IDs from the webpage itself to work. Browsers have a native function to automatically scroll pages depending on the link that directs you there.
The link https://yourinstance.net will lead you to the start of your page. The link https://yourinstance.net#nextelement will land you right at the element with id nextelement.
As you can see in this screenshot:
What the ToC macro does is create a link that has the #<elementID> at the end. Even though the macro makes use of the <elementID>, the function itself is part of the browser, not Confluence.
Let us hear from you Halvard! Looking forward to your reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the reply. The reason for this problem is because i made the header bigger and it made the heading hidden beneth the header.
I managed to fix this by adding some css to h2 tags in these pages. Because we are using the same naming convention it makes it easy to just style the h2 tags in the right pages.
h1[id*="2019."]{
padding-top: 70px !important;
margin-top-30px !Important;
}
((I added this as a response and accepted it as an answer))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Halvard!
Thank you very much for sharing the solution to this. Having some CSS styling can get us a long way!
This shared knowledge will probably help more users of our community.
Let us hear from you.
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.