concept

Named page — CSS reference

A named page rule describes a specific page style referenced by the page property on applicable content. The name is a CSS identifier rather than a DOM id. This example demonstrates a change of page dimensions at the second section.

Formal Syntax & Structure

css syntaxcss
@page wide { size: 400px 300px; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Named page</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}p{margin:0;font:12px/16px sans-serif}.next{break-before:page}@page{size:300px 400px;margin:40px;}@page wide{size:400px 300px} .wide{page:wide}</style><body><main><p>ONE</p><p class="wide">TWO</p></main></body></html>
CSS Reference