Customize PDF output with CSS
masterThe exported PDF supports the CSS paged media module. You can adjust margins, fonts, headers, and footers by adding a custom stylesheet to your MkDocs project.
To apply these styles, use the extra_css directive in your mkdocs.yml.
Example CSS for @page customization:
@page {
size: a4 portrait;
margin: 25mm 10mm 25mm 10mm;
counter-increment: page;
font-family: "Roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
@top-left {
content: '© 2018 My Company';
}
@top-center {
content: string(chapter);
}
@top-right {
content: 'Page ' counter(page);
}
}