Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I align reveal.js slides to the top of the page?

Tags:

css

reveal.js

I'm using reveal.js and trying to sort out how to force my slides to the top left-most corner of the page. That seems like it should be straightforward, but when I use the Element inspector it so radically changes the page that I can't even begin to zero in on how to move the slides up to the top.

Adding this to my theme:

.reveal .slides>section,
.reveal .slides>section>section {
    padding: 0;}

Bumped it up a smidge (reveal.css has the padding set to 20px 0) but there's still white space at the top of each slide.

like image 293
Amanda Avatar asked Mar 17 '14 02:03

Amanda


People also ask

How do I align text to the left on a slide?

Yep, you can use CSS to style text to left align it. For individual slides, you can even use inline styles, like <section style="text-align: left;"> to do so. Sorry, something went wrong. PPT 能左对齐么?

Is there a way to left align text in Rmarkdown slides?

I haven't mastered adjusting CSS in RMarkdown yet, but I just came across this (clumsier) solution on Stack Overflow that left-aligns all text in the slides, although not the titles: Sorry, something went wrong. Yep, you can use CSS to style text to left align it.

How do I change the navigation behavior of my reveal presentation?

You can fine tune the reveal.js navigation behavior by using the navigationMode config option. Note that these options are only useful for presentations that use a mix of horizontal and vertical slides. The following navigation modes are available: Left/right arrow keys step between horizontal slides.

How do I align my paragraphs to the left in Sky?

If you start changing the CSS options, you might as well do that right in the theme's CSS file, where most of these things are defined anyway. For example, you will find this in the "sky.css" file in the themes folder. Just add the CSS snippet "text-align: left;" to this, and your paragraphs will be aligned as desired:


2 Answers

To move your slides to the top is just a configuration option of reveal.js.

Reveal.initialize({
    center: false
}

I haven't figured it out how to move them to the left though.

Horizontal alignment can be done from CSS:

.reveal .slides { margin: 0; }
like image 73
riezebosch Avatar answered Oct 26 '22 17:10

riezebosch


You can used fixed positioning if you want the slides to stay in the same place as you scroll. But if you want them to stay at the top you need to use absolute positioning.

.slides {
    position: absolute;
    top: 0;
    left: 0;
}

This will set the div at the 0th pixel from the top and the 0th pixel from the left. Obviously, if you want some separation you can change these numbers.

like image 40
tywalker Avatar answered Oct 26 '22 17:10

tywalker