Manuel Spínola
Manuel Spínola

Reputation: 79

Centering the text in a heading of a title slide using css in xaringan rmarkdown

How can I center the text in a heading of a title slide using css in xaringan rmarkdown. Using the below code it didn't.

.title-slide h3:nth-child(2) {
    font-weight: normal;
    font-size: 40px;
    text-align: center;
    color: grey;
    margin-top: 350px; 
}

---
title: "Correlación"
author: "Manuel Spínola"
date: "`r Sys.Date()`"
output:
  xaringan::moon_reader:
  css: mi_estilo.css
  lib_dir: libs
  nature:
    highlightStyle: github
    highlightLines: true
    countIncrementalSlides: false

   ```{r setup, include=FALSE}
   options(htmltools.dir.version = FALSE)
   ```


   # Hola

Upvotes: 0

Views: 1510

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30184

Use the absolute position, e.g.

.title-slide h3:nth-of-type(2) {
    position: absolute;
    top: 0;
}

Upvotes: 1

Related Questions