Skip to content

Vertically and horizontally centered content in slides (revealjs) #2951

Answered by mcanouil
awav asked this question in Q&A
Discussion options

You must be logged in to vote

#1386 is for centering content of a column, not the content of a slide.

Inspired from @pat-s post on Twitter1:

---
format:
  revealjs:
    include-in-header: 
      text: |
        <style>
        .center-xy {
          margin: 0;
          position: absolute;
          top: 50%;
          left: 50%;
          -ms-transform: translateY(-50%), translateX(-50%);
          transform: translateY(-50%), translateX(-50%);
        }
        </style>
---

## Slide 1

::: {.center-xy}

Text

:::

Footnotes

  1. https://twitter.com/patscli/status/1582832917302358016

Replies: 3 comments 16 replies

Comment options

You must be logged in to vote
11 replies
@mcanouil
Comment options

@RoyiAvital
Comment options

@mcanouil
Comment options

@RoyiAvital
Comment options

@RoyiAvital
Comment options

Answer selected by mcanouil
Comment options

You must be logged in to vote
2 replies
@mcanouil
Comment options

@JonSilas
Comment options

Comment options

You must be logged in to vote
3 replies
@mcanouil
Comment options

mcanouil Oct 5, 2023
Collaborator

@chuxinyuan
Comment options

@mcanouil
Comment options

mcanouil Oct 5, 2023
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
revealjs Issues with the revealjs format
5 participants