Layout

Stretch class attribute

reveal.js supports a special class that will give all available screen space to an HTML element. This class element is named stretch.

Sometimes it’s desirable to have an element, like an image or video, stretch to consume as much space as possible within a given slide.

To add this class to an HTML element, you can assign a role to a block using the shorthand dot (.) syntax:

[.stretch]

Stacking elements

reveal.js can also stack elements on top of each other with the r-stack class, and lay them out horizontally or vertically with r-hstack/r-vstack — handy for flipping through a sequence of images (e.g. a "before"/"after" pair) that occupy the same spot on the slide. Apply the class to an open block wrapping the elements to stack:

[.r-stack]
--
image::before.png[]

image::after.png[]
--

Combine with the step option on each element (see Steps) to flip from one to the next instead of showing them all stacked at once:

[.r-stack]
--
[%step]
image::before.png[]

[%step]
image::after.png[]
--

Vertical slides

== Slide 6

Top slide

=== Slide 6.1

This is a vertical sub-slide

Slide 6 uses the vertical slide feature of reveal.js. Slide 6.1 will be rendered vertically below Slide 6. Here is the relevant reveal.js documentation on that topic.

Columns layout

Inspired by Bulma, Asciidoctor reveal.js supports columns layout out-of-the-box:

Every piece of content on a [.columns] slide needs to be inside a [.column] block — including any introductory text before the columns themselves. Content that isn’t wrapped in [.column] still becomes a flex item of the row (since the columns layout applies to the slide’s content as a whole), so it ends up squeezed alongside the columns instead of spanning the full width above them. To get a full-width row above the columns, wrap that content in [.column.is-full] (see the size classes below) and add the wrap class (see Wrapping columns) to the slide so the is-full row and the columns below it can each get their own row instead of competing for the same one.
[.columns]
== 2 columns

[.column]
--
* **Edgar Allan Poe**
* Sheri S. Tepper
* Bill Bryson
--

[.column]
--
Edgar Allan Poe (/poʊ/; born Edgar Poe; January 19, 1809 – October 7, 1849) was an American writer, editor, and literary critic.
--

If you do not specify a size, each column will have an equal width, no matter the number of columns.

[.columns]
== 3 columns

[.column]
* Java
* **Kotlin**

[.column]
* Node
* **Deno**

[.column]
* Ruby
* **Crystal**

Wrapping columns

By default, columns share the available width equally and never wrap onto a new row — content that doesn’t fit is shrunk to stay within its column instead. That’s usually what you want for text content, even when columns hold an uneven amount of it.

Add the wrap class when you’d rather have each column size itself to its content’s natural width, wrapping onto a new row if the columns don’t all fit on one — useful for content that shouldn’t be shrunk, such as images:

[.columns.wrap]
== Wrapping Columns

[.column]
image::wide-image-1.png[]

[.column]
image::wide-image-2.png[]
wrap changes how every column in that row sizes itself, not just the one that needs it. Adding it to a row of text columns (rather than images) usually produces the opposite of the default, equal-width behavior: each column claims as much width as its own content wants, which can push columns onto separate rows well before the slide is actually full. If you just want equal-width columns whose content shrinks to fit, leave wrap off — that’s the default.

If you want to change the size of a single column, you can use one of the following classes:

  • is-three-quarters

  • is-two-thirds

  • is-half

  • is-one-third

  • is-one-quarter

  • is-full

The other columns will fill up the remaining space automatically.
You can use the following multiples of 20% as well:

  • is-four-fifths

  • is-three-fifths

  • is-two-fifths

  • is-one-fifth

[.columns]
== Columns with size

[.column.is-one-third]
--
* **Kotlin**
* Java
* Scala
--

[.column]
--
Programming language for Android, mobile cross-platform
and web development, server-side, native,
and data science. Open source forever Github.
--

The vertical alignment of columns defaults to top aligned. Content can be centered by adding the is-vcentered class to the slide.

[.columns.is-vcentered]
== Columns Vertically Centered

[.column]
--
* Few
* Bullets
* Here
--

[.column]
image::large-image.png[]

Text alignment of columns is also supported. Text content on individual columns can be aligned with has-text-left, has-text-right and has-text-justified CSS classes.

[.columns]
== Column Text Alignment

[.column.has-text-left]
--
Something Short

Something So Long That We Need It Aligned
--

[.column.has-text-justified]
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

[.column.has-text-right]
--
Something Short

Something So Long That We Need It Aligned
--