Computer >> Computer tutorials >  >> Programming >> CSS

CSS @page rule


You can specify the dimensions, orientation, margins, etc., of a page box within an @page rule. The dimensions of the page box are set with the 'size' property. The dimensions of the page area are the dimensions of the page box minus the margin area.

For example, the following @page rule sets the page box size to 8.5 × 11 inches and creates '2cm' margin on all sides between the page box edge and the page area:

<style>
   <!--
      @page { size:8.5in 11in; margin: 2cm }
   -->
</style>