Typeset.sh
HomeNewsDemoPricing
  • Getting started
    • Installation
    • Using typeset.sh
    • First template
    • CSS and paged media
      • Page counters
      • Page selectors
      • Page groups
      • Running elements
      • Bleed area
    • Convert from URL
    • Document Metadata
    • Changelog
  • Advanced guides
    • QR codes
    • Save handlers
    • Error handling
    • Signing a PDF
    • PDF Standards
      • ZUGFeRD
      • PDF/A
      • PDF/UA
      • PDF/X-4
    • Color profiles
    • JavaScript
    • Common Object/Classes
      • createPdf function
      • HtmlToPdf
      • Result Object
Powered by GitBook
On this page
  1. Getting started
  2. CSS and paged media

Page groups

PreviousPage selectorsNextRunning elements

Last updated 2 years ago

Using named pages and page selectors you can create so called page groups.

If you have a document with multiple chapters that span several pages and you want to select only the first page of each chapter, you can do so by enclosing each chapter in its own element and forcing a named page (e.g. chapter). You can then use the nth() selector to select the first page of all chapters.

@page :nth(1 of chapter) {
    background: lightgrey;
}

section.chapter {
    page: chapter;
}

See

https://www.w3.org/TR/css-gcpm-3/#document-sequence-selectors
CSS page groups (Live Demo)
Logo