0

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

1 Answers1

1

Use the absolute position, e.g.

.title-slide h3:nth-of-type(2) {
    position: absolute;
    top: 0;
}
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
  • It didn't work. My intention is to center horizontally, not vertically. I don't understand why text-align: center, it doesn't work. – Manuel Spínola Oct 02 '17 at 01:52