What Is @page In CSS 2023

By XiaoXin
A Bit Randomly

1: find / -name "filename" Searches for files in the directory structure and performs the specified operation. 2:grep  3: local file name--- this is another way of writing 'find -name', but it is much faster than the ... Read Explain find command in Linux

Main Contents

What Is @page In CSS

The @page at-rule in CSS is used to modify different aspects of a printed page, such as its dimensions, orientation, and margins. This allows you to control the appearance of your content when it is printed, and ensure that it is formatted correctly for the page.

/* Targets all the pages */
@page {
  size: 8.5in 9in;
  margin-top: 4in;

/* Targets all even-numbered pages */
@page :left {
  margin-top: 4in;

/* Targets all odd-numbered pages */
@page :right {
  size: 11in;
  margin-top: 4in;

The @page at-rule can be used to target all pages in a print-out, or specific pages using its various pseudo-classes, such as :first, :left, or :right. This allows you to apply different styles to different pages in your print-out, depending on their position or other characteristics. For example, you might use the @page at-rule to specify different margins for the first page of your document, or to apply a specific background color to all left-hand pages in a two-column layout. This allows for more fine-grained control over the appearance of your printed content.

Please Share This Article Thank You!

Parts of CSS @At-Rules Explanation
What Is @property In CSS

The @property at-rule in CSS is part of the CSS Houdini umbrella of APIs, which allows developers to explicitly define custom CSS properties and control their behavior. The @property rule allows you to define the type of a...

What Is @namespace In CSS

The @namespace at-rule in CSS is used to define XML namespaces, which are used to qualify element and attribute names in XML documents. This allows you to use namespaced elements and attributes in your CSS styles, and ensu...