Skip to content

Coloring jupyter book text properly #588

Answered by ZviBaratz
mscharling asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mscharling,
Generally speaking, to add custom CSS follow the docs and create book/_static/custom.css.
More specifically, links are represented by HTML's <a> tag. To change the color of hovered links, you should include the following rule in your CSS:

a:hover {
    color: red;
}

Jupyter book adds the "reference" and "internal" classes to the table of content links, so if you wanted to change only those, it would be:

a.reference.internal:hover {
    color: red;
}

However, it seems like this rule is overridden by the theme, so to force it you should include the !important tag:

a.reference.internal:hover {
    color: red!important;
}

Hope this helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mscharling
Comment options

Answer selected by mscharling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants