Site logo

Archived topic

Custom CSS for Table of Contents not working

3 replies · Started by Rachel on November 17, 2021

Viewing posts 1–4 of 4

Hi there,
I have added some custom css to add underline and bold to my links within articles. Unfortunately this is also making my table of contents entries bold.

I am trying to exclude the table of contents from this css, as I don't want the TOC entries to be bold, but I can't work out how to exclude the TOC. This is what I have added:

.single-post .entry-content a:not(.toc_list) {
text-decoration: underline;
font-weight: bold;
}

Can you help advise what I need to exclude?

Thanks,
Rachel

Hi Rachel,

Try this CSS:

.single-post .entry-content > *:not(div#toc_container) a {
text-decoration: underline;
font-weight: bold;
}

Hi Elvin,
Thank you that worked! I wouldn't have been able to stumble across that in a million years, so thanks so much for your help.

Cheers,
Rachel

Yeah, CSS gets a bit tricky when there's "conditions" involved because it isn't exactly a programming language.

Glad you got it sorted. No problem. :D

This archived topic is closed to new replies.