Search code examples
rr-markdownquarto

Change title size and color in Quarto (html output)


I have a quarto file with an HTML rendering, and I want to change the size and color of the title, how should I proceed? Minimal example:

---
title: "Cars"
format: 
  html
---

## MTCars
```{r}
head(mtcars)
```

Solution

  • You can use css directly in your code; specify .title to apply your changes to the title only.

    With font-size, you can change the size of the title, and with color you can change the color. You can also change the style with font-style, the family (e.g. Arial) with font-family, and the variant with font-variant.

    ---
    title: "Cars"
    format: 
      html
    ---
    
    ```{css, echo=FALSE}
    .title {
      font-size: 100px;
      font-style: italic;
      color: blue;
      font-family: Arial;
      font-variant: small-caps;
    }
    ```
    
    ## MTCars
    ```{r}
    head(mtcars)
    ```
    

    enter image description here