This page provides an overview of reveal.js's styling architecture, including the core CSS structure, theming system, and how visual presentation is managed. It covers the organization of stylesheets, CSS custom properties, transition effects, and the theme compilation workflow.
For detailed information about:
For runtime background management and parallax effects, see Backgrounds Controller.
Reveal.js uses Sass (SCSS) as its CSS preprocessor. The core stylesheet is reveal.scss, which contains all base presentation styling compiled into dist/reveal.css during the build process.
The main css/reveal.scss file is organized into distinct functional sections:
Sources: css/reveal.scss1-2233
The reveal.scss file contains the following major sections:
| Section | Lines | Purpose |
|---|---|---|
| Global Styles | 16-56 | Viewport, fullscreen, base layout |
| Fragments | 63-223 | Fragment visibility and animations |
| Controls | 249-518 | Navigation arrow styling and positioning |
| Progress Bar | 574-603 | Horizontal progress indicator |
| Slide Number | 609-629 | Slide counter display |
| Slides Container | 635-752 | Core slide positioning and display |
| Transitions | 758-1067 | Slide transition effects (slide, convex, concave, zoom, fade) |
| Pause Overlay | 1073-1107 | Black screen pause mode |
| Backgrounds | 1129-1298 | Per-slide background rendering |
| Auto-Animate | 1310-1320 | Unmatched element handling |
| Overview Mode | 1327-1392 | Grid view styling |
| Overlay System | 1445-1673 | Help dialog and preview overlays |
| Code Highlighting | 1698-1740 | Syntax highlighting integration |
| Scroll View | 1995-2223 | Continuous scroll mode |
| Print Styles | 2230-2231 | PDF/print output |
Sources: css/reveal.scss1-2233
Reveal.js applies styles in a layered architecture, where each layer builds upon the previous:
Sources: css/reveal.scss16-41 css/reveal.scss635-752
Reveal.js uses CSS custom properties (CSS variables) prefixed with --r- for dynamic theming and responsive behavior:
--r-controls-spacing Navigation arrow spacing
--r-overlay-header-height Overlay header size
--r-overlay-margin Overlay outer margin
--r-overlay-padding Overlay inner padding
--r-overlay-gap Overlay element gap
Sources: css/reveal.scss35-40
--r-scrollbar-width Custom scrollbar width
--r-scrollbar-trigger-size Fragment trigger size in scrollbar
--page-height Scroll page container height
--page-scroll-padding Spacing between scroll pages
--slide-width Slide content width
--slide-height Slide content height
--slide-scale Slide scaling factor
Sources: css/reveal.scss2007-2089
--r-link-color Primary link color (used in outline)
--r-overlay-element-bg-color Scrollbar background RGB values
--r-overlay-element-fg-color Scrollbar foreground RGB values
Sources: css/reveal.scss1346 css/reveal.scss2117-2126
Reveal.js handles viewport height across different browsers using a fallback cascade:
Sources: css/reveal.scss18-21
Fragments use a combination of opacity, visibility, and transform properties to create step-by-step reveals. All fragment animations have a base transition duration of 0.2s.
| Class | Opacity | Visibility | Notes |
|---|---|---|---|
.fragment | 0 | hidden | Initial state |
.fragment.visible | 1 | inherit | Revealed state |
.fragment.current-fragment | 1 | inherit | Currently active |
.fragment.disabled | varies | varies | Transitions disabled |
Sources: css/reveal.scss63-223
Reveal.js provides multiple transition types through Sass mixins that generate CSS for horizontal and vertical navigation:
Each transition type is applied through attribute selectors that check data-transition or the global .reveal class:
.reveal .slides section[data-transition=zoom]
.reveal.zoom .slides section:not([data-transition])
Sources: css/reveal.scss758-799 css/reveal.scss805-1067
The presentation includes several UI control elements styled in reveal.scss:
Arrow-based navigation controls with hover/active states:
3.6em ($controlArrowSize)2.6em ($controlArrowLength)0.5em ($controlArrowThickness)Controls invert color based on slide background contrast detection.
Sources: css/reveal.scss267-518
A horizontal bar at the bottom showing presentation progress:
scaleX(0) to scaleX(1) with cubic-bezier easingrgba(0, 0, 0, 0.2) with configurable foreground colorSources: css/reveal.scss574-603
Position indicator in bottom-right corner:
rgba(0, 0, 0, 0.4)Sources: css/reveal.scss609-629
Each view mode applies distinct CSS that fundamentally changes presentation layout:
.reveal.overview)opacity: 1 !importantSources: css/reveal.scss1327-1392
.reveal-viewport.reveal-scroll).scroll-page containersposition: sticky for smooth scrollingSources: css/reveal.scss1995-2223
.reveal.paused)opacity: 1 and visibility: visibleSources: css/reveal.scss1073-1107
Per-slide backgrounds are rendered in a separate .backgrounds container that sits behind .slides:
Backgrounds support:
background-color)background-position, background-size, background-repeat)<video> with object-fit).backgrounds containerSources: css/reveal.scss1129-1298 css/reveal.scss1428-1438
Reveal.js includes a unified overlay system for help dialogs and media previews:
Structure:
.r-overlay Full-screen overlay container
.r-overlay-viewport Content area with padding
.r-overlay-header Header with close/external buttons
.r-overlay-content Main content area
Styling features:
rgba(0, 0, 0, 0.95) with backdrop-filter: blur(10px)fade-in (opacity) and scale-up (transform)Sources: css/reveal.scss1445-1673
Themes in reveal.js are Sass files that:
css/theme/template/mixins.scssdist/theme/Themes can override:
For detailed theme creation workflow, see Creating Custom Themes.
Sources: css/reveal.scss1-7 (header comments)
Reveal.js adapts styling based on viewport size through media queries:
| Breakpoint | Target | Changes |
|---|---|---|
max-width: 500px | Small phones | Controls spacing reduced to 0.8em |
min-width: 500px | Tablets+ | Edge-aligned controls layout available |
max-width: 600px | Phones | Speaker notes take 40vh instead of 30vh |
max-width: 1024px | Tablets | Overlay header height reduced to 26px |
min-width: 1600px | Large displays | Speaker notes font size 20px |
-webkit-tap-highlight-color: rgba(0, 0, 0, 0).reveal.no-hover)Sources: css/reveal.scss42-46 css/reveal.scss520-567 css/reveal.scss1849-1887
Print styles are imported from separate files and apply when:
.print-pdf class is present on .revealPrint mode:
opacity: 1 !important and visibility: visible !importantFor complete print/PDF workflow, see Print and PDF Export.
Sources: css/reveal.scss2230-2231 css/reveal.scss1171-1174
The .reveal.rtl class applies:
direction: rtl to slides and headingsdirection: ltr for code blocks (maintain code readability)text-align: right for liststransform-origin: 100% 0 for progress bar (right-to-left growth)Sources: css/reveal.scss1399-1422
The CSS compilation workflow integrates with the Gulp build system:
css/reveal.scss imports css/layout.scssdist/reveal.css and dist/reveal.min.cssTheme files follow the same pipeline independently.
For build system details, see Build System.
Sources: css/reveal.scss9-10 (import statement)
Refresh this wiki