Home  >  Article  >  Web Front-end  >  Setting the page size value in CSS

Setting the page size value in CSS

WBOY
WBOYforward
2023-08-25 19:53:021139browse

CSS 中设置页面大小的值

There are four values ​​available for setting the page size -

  • auto − The page box will be set to the target worksheet size and direction.
  • Lateral− Cover the direction of the target. The page box is the same size as the target, with the longer side horizontal.
  • Portrait - Overrides the orientation of the target. The page box is the same size as the target, with the short side horizontal.
  • Length - The length value of the "size" attribute creates an absolute page box. If you specify only a length value, both the width and height of the page box are set. Percentage values ​​are not allowed for the 'size' attribute.

In the following example, the outer edge of the page box will be aligned with the target. The percentage value of the Margins property is relative to the target size, so if the target paper size is 21.0 cm × 29.7 cm (i.e. A4), the margins are 2.10 cm and 2.97 cm.

<style type = "text/css">
   <!--
      @page {
         size: auto; /* auto is the initial value */
         margin: 10%;
      }
   -->
</style>

The above is the detailed content of Setting the page size value in CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:CSS play-during propertyNext article:CSS play-during property