Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reveal js stretch background image to fit

Tags:

reveal.js

I'm trying to get the background image in my reveal js presentation to adjust its aspect ratio to fit the screen. Changing the size seems simple enough via

data-background-size=...

but I can't find anywhere that shows me how to make the image stretch to fit the screen

like image 688
sean read Avatar asked Oct 31 '22 04:10

sean read


2 Answers

You can do it manually entering two parameters: data-background-size="800px 600px" for example.

like image 197
David Sevilla Avatar answered Dec 09 '22 18:12

David Sevilla


This stretches the image to fit the slide, keeping its aspect ratio:

data-background-size="contain"

The attribute is mentioned in the Backgrounds section of the documentation.

For possible values of data-background-size, see the MDN documentation.

like image 32
Matthias Braun Avatar answered Dec 09 '22 17:12

Matthias Braun