Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to position a background image in reveal.js?

I want to have a background image on the right hand side of one slide in a reveal.js presentation.

I added the image to the slide like this:

 <section data-background="myImage.jpg">
  // content
 </section>

How can I add css styles to make it appear on the right edge of the screen?

like image 376
Jens Schauder Avatar asked Aug 24 '14 11:08

Jens Schauder


1 Answers

This article helped to find the solution. You can add a style to the html element for the current section using

data-state="something"

and of course you can use that style for tweaking your css. So I used this html:

<section data-background="myImage.jpg" data-state="img-right">
    // content
</section>

and the following css:

html.img-right div.slide-background.present {
    background-position: right;
}
like image 128
Jens Schauder Avatar answered Sep 23 '22 06:09

Jens Schauder