Search code examples
cssmarkdownquartoreveal.js

Vertical aligning the first-level slides in Quarto revealjs


I am creating a presentation in Reveal using Quarto markdown with horizontal and vertical slides. The content of the first-level slides is vertically centered, is there a way (possibly using CSS) to have it aligned at the top of the slide?

---
title: "My presentation"
format: revealjs
---

# First horizontal slide
- Content
- Content

# Second horizontal slide
- Content
- Content

## First vertical slide
- Content
- Content

Solution

  • Yes, just add the following css.

    style.css

    section.level1 {
        top: 0px !important;
    }
    

    presentation.qmd

    ---
    title: "My presentation"
    format: revealjs
    css: styles.css
    ---
    
    # First horizontal slide
    - Content
    - Content
    
    # Second horizontal slide
    - Content
    - Content
    
    ## First vertical slide
    - Content
    - Content