Direkt zum Hauptinhalt

Useful CSS Rules

Here, we're trying to list the most useful css rules for (print/pdf/ebook) publications.

Page Setup

Originally, CSS was designed for websites, not paged media. Therefore, we have to tell CSS that we want pages.

@pageDOC

The @page at-rule is a CSS at-rule used to modify different aspects of printed pages. It targets and modifies the page's dimensions, orientation, and margins.

@page {
    size: A4; /* This is the page size */
    margin: 2cm; /* margin between page border and content. */
}
sizeDOC

Total page size, Example values: A4, 10cm 10cm, …

marginDOC