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.
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 能左对齐么?
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.
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.
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:
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; }
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With