Search code examples
quartoreveal.js

Center slide header in middle of revealjs Quarto


I would like to center a slides header in the middle of the slide. It should actually look the same as in the title slide. I tried using {.center}, but that only centers vertically and not horizontally. Here is some reproducible code:

---
title: "Center slide in middle"
format: revealjs
---

## Slide {.center}

Output:

enter image description here

As you can see it is vertically centered but not horizontally. So I was wondering if anyone knows how to center the slide header in the middle of a slide in revealjs Quarto?


Solution

  • ---
    title: "Center slide in middle"
    format: revealjs
    engine: knitr
    ---
    
    
    ## Slide {.center}
    
    ```{css}
    .center h2 {
      text-align: center;
    }
    ```
    

    slide header centered