Larry K
Larry K

Reputation: 49114

What is @page in 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.

Upvotes: 4

Views: 7014

Answers (2)

Matthew Vines
Matthew Vines

Reputation: 27591

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

Upvotes: 5

Dan Inactive
Dan Inactive

Reputation: 10060

@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

Upvotes: 6

Related Questions