Skip to content

Use a css code chunk to embed the CSS rules directly in your quarto document #1402

Answered by cderv
ManuelSpinola asked this question in Q&A
Discussion options

You must be logged in to vote

@ManuelSpinola yes any knitr feature will work with Quarto when you are knitr computation engine

---
format: html
---

```{css, echo = FALSE}
h1 {
  color: red;
}
```

# Red header 

Some content

```{r}
1 + 1
```

If you try without any R chunk inside the document, you need to explicitly configure the use of knitr engine

---
format: htlm
engine: knitr
---

See about engine binding

However, knitr will indeed write the same content from the chunk as @mcanouil answer - so directly writing raw block is a solution.

For styling with Quarto, using the theme file stays the recommended way: https://quarto.org/docs/output-formats/html-themes.html#theme-options

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mcanouil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
html Issues with HTML and related web technology (html/css/scss/js) themes Related to HTML theming or any other style related issue (like highlight-style)
3 participants