CSS Variables
Root-level custom properties for consistent theming
:rootRequiredCSS custom properties for theme-wide consistency
Create beautiful, print-ready PDF themes. This guide covers all required CSS selectors, properties, and best practices for MPDF theme development.
Root-level custom properties for consistent theming
:rootRequiredCSS custom properties for theme-wide consistency
These utility classes are automatically available in every theme. They're part of the MPDF system CSS and handle pagination and print quality.
.page-breakForces a page break before the element. Use for multi-page documents.
<div class="page-break"></div>.page-break-afterForces a page break after the element.
<div class="page-break-after">Content</div>.no-breakPrevents page breaks inside the element. Keeps content together.
<div class="no-break">Keep together</div>.keep-togetherAlias for .no-break. Prevents content from splitting across pages.
<div class="keep-together">...</div>.no-printHides element when printing/generating PDF. Screen only.
<div class="no-print">Screen only</div>.print-onlyShows element only when printing. Hidden on screen.
<div class="print-only">Print only</div>Every theme must define these CSS custom properties in :root. This ensures consistent theming across all components.
| Variable | Description | Required |
|---|---|---|
--color-primary | Primary brand color | Required |
--color-accent | Secondary/accent color | Required |
--color-text | Main text color | Required |
--color-text-light | Secondary text color | Required |
--color-text-muted | Muted/disabled text | Optional |
--color-background | Page background color | Required |
--color-surface | Surface/card background | Required |
--color-border | Border color | Required |