How do I change the color of the text in my TOC (added as a macro)?

I added a TOC to my page but I want to change the color of the text so it is different than the other text on the page. I assume I have to use CSS but I have no idea what to add into the CSS stylesheet. Any help would be greatly appreciated!

2 answers

1 accepted

You need to edit the TOC and add a CSS Class Name via the dialog, eg. "mytocclass". That gets applied to the DIV around the TOC list.

Then style away (I'm assuming you already know where to put the CSS), noting some selectors will need to be quite strong to apply over the existing CSS. A simple trick is to start with an ID selector eg:

#com-atlassian-confluence .mytocclass ul li a { background: green; color: white; }

Hope that helps.

Thank you so much Ben, that did the trick!!!

I am using the ‘Table of Contents’ Macro and would like to edit the CSS. I am assuming this is done via the "CSS Class Name" field in the macro.

However, it seems that if you are using OnDemand, you can not do this. Can you explain "where to put the CSS"?

Thankyou.

@John:

You could try the following:

Enter something like "mytocclass" to the "CSS Class Name" field of the toc macro and then define the mytocclass in the Browse > Space Admin > Look and Feel > PDF Stylesheet by entering something like

.mytocclass a {
color:red;
}

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,037 views 15 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you