Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is @page in CSS?

Tags:

css

I'm creating an epub file and am trying to understand an example css for an ebook:

@page {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}

What's the @page rule? I can't find it in my books or Google.

like image 809
Larry K Avatar asked Dec 23 '22 11:12

Larry K


2 Answers

@page describes how your document should behave on page-based media (like print). This should clear it up: http://www.w3.org/TR/CSS21/page.html

like image 168
Dan Burzo Avatar answered Dec 30 '22 20:12

Dan Burzo


A page box is a rectangular region that contains two areas:

  • The page area. This area includes the boxes laid out on that page. The edges of the page area act as the initial containing block for layout that occurs between page breaks.
  • The margin area, which surrounds the page area.

We specify the size, margins, etc. of a page box within a @page rule.

The size of the page box is set with the size property. The size of the page area are the size of the page box minus the margin area.

Per this link to w3c schools

like image 44
Matthew Vines Avatar answered Dec 30 '22 20:12

Matthew Vines