user19100232
user19100232

Reputation:

How to change the font colour od in the table of content in HTML/rmarkdown?

When I specify the code like this, the fonts in the table of content is given in red in HTML. So, how can I change the font colour?

output:
  html_document:
    toc: true
    toc_depth: 2
    theme: united

Upvotes: 0

Views: 191

Answers (1)

Domingo
Domingo

Reputation: 671

you can add a css chunk in your rmarkdown-file:

```{css}

#TOC {
    color: blue;
}

#TOC a:link {
  color: green;
}

/* visited link */
#TOC a:visited {
  color: cyan;
}

/* mouse over link */
#TOC a:hover {
  color: hotpink;
}

/* selected link */
#TOC a:active {
  color: blue;
}


```

The div for the table of content is called #TOC and it is possible to directly change the properties.

Upvotes: 1

Related Questions