Changing font size in Rmarkdown presentation using revealjs

elvikingo

Just a quick query about the revealjs options one can use to create slides. I love a lot of its features but I'm unable to figure out if I can change the font size of text globally. The <small> html tag makes it possible to make certain sections smaller, but I'd like to know if there's an option to specify something perhaps in the YAML header for the whole slide deck. I believe CSS might be my answer but I'm genuinely confused at the various options in CSS to change font size.

Any help hugely appreciated.

Thank you!

Maurits Evers

Here is a minimal example:

---
title: "Untitled"
output: 
    revealjs::revealjs_presentation:
        css: styles.css
---

## Test slide

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

```{r}
head(mtcars)
```

The content of styles.css looks like this

.reveal section p {
    font-size: 0.5em;
}

.reveal section pre code {
    font-size: 0.7em;
}

This changes the font size globally

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Scroll slides in RMarkdown presentation (revealjs)

Quarto Revealjs presentation change Title, Author & Date position, font, size and colour

Changing the font size of figure captions in RMarkdown pdf output

Changing the font size of figure captions in RMarkdown HTML output

Changing the font size of figure captions in RMarkdown Word output

How to change fonts using revealjs_presentation of R Markdown?

Rmarkdown font size and header

Changing font size using document.getElementById

Changing font size using keyboard and mouse

Quarto revealjs: increase relative font size of code chunks

Is it possible to control font size in the tables while using rmarkdown/bookdown?

Changing font size in Java

Font Size Changing with Refresh

PIL font size not changing

Font size changing buttons

Change font size in RMarkdown PDF

Font size in ioslides markdown presentation title page

font size in presentation made by python-pptx

Add sections to beamer presentation using rmarkdown and knitr

Changing font-size of elements using map, list and for loop in sass

Changing font size and text color of an element using arrow functions and addEventListener

Issue while changing font size/family using media query bootstrap

Changing the font size of table using print.xtable

Changing the font size of multipanel Taylor plot using openair package in R

Changing font family for a paragraph in latex rmarkdown

Incorporate Leaflet map in revealjs presentation within R

Intercept event on changing font size

changing treeview's font and size

Dynamically changing font size of UILabel