--- title: '@page' slug: Web/CSS/@page tags: - '@page' - At-rule - CSS - Layout - NeedsTranslation - Reference - TopicStub - Web translation_of: Web/CSS/@page ---
The @page
CSS at-rule is used to modify some CSS properties when printing a document.
@page { margin: 1cm; } @page :first { margin: 2cm; }
size
marks
bleed
You can't change all CSS properties with @page
. You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored.
The @page
at-rule can be accessed via the CSS object model interface {{domxref("CSSPageRule")}}.
vh
, vw
, vmin
, and vmax
. Meanwhile do not use them within a @page
at-rule.Please refer to the various pseudo-classes of @page
for examples.
Specification | Status | Comment |
---|---|---|
{{SpecName('CSS Logical Properties', '#page', ':recto and :verso')}} | {{Spec2('CSS Logical Properties')}} | Adds the :recto and :verso page selectors |
{{SpecName('CSS3 Paged Media', '#at-page-rule', '@page')}} | {{Spec2('CSS3 Paged Media')}} | No change from {{SpecName('CSS2.1')}}, though more CSS at-rules can be used inside a @page . |
{{SpecName('CSS2.1', 'page.html#page-selectors', '@page')}} | {{Spec2('CSS2.1')}} | Initial definition |
{{Compat("css.at-rules.page")}}