Thread: Page or Body?
View Single Post
Old 04-27-2010, 02:55 PM   #2
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
The @page directive differs from a tag rule in that it refers to the page that's actually displayed rather than a logical entity. The only attributes that you can use govern the margins, and, since there's no font size defined in this context, you have to use absolute measurements or % values.

Generally, margin-top and margin-bottom are best placed in the @page directive, where they will govern the top and bottom margins of each displayed page. The margin-top and -bottom values in the body definition will govern the margins of the entire flow, so if you have some text that flows over several pages, the margin-top value from body would be seen on the first page, and the bottom value on the last page, which would probably not be what you want.

You could place margin-left and -right values in the @page rule, but ADE places its right-side page numbers inside the page, but outside the body. This means that to get maximum clearance between these page numbers and the text it's best to leave the @page margin-left and -right at 0, then define a left and right margin in the body.

What I use is:
Code:
@page {
  margin-top: 9pt;
  margin-bottom: 1pt
}

body {
  margin-left: 12pt;
  margin-right: 12pt
}
The margin-bottom value is really there just to prevent ADE allowing text to collide with the bottom of the page, which leads to it greying-out the lower pixels of descenders. In practice the actual size of the bottom margin will depend on how many lines fit into a page and whether the orphan rule is being applied.

I prefer to use absolute values for the page margins (the one area where this makes sense), but it's possible to use % values instead, in which case the size of the margin varies with the size of the display. This can help to modulate margin size for those reading on small devices like smartphones, but may lead to needlessly large margins on bigger screens. A value of 2% is usually best if you go this route, larger vlaues can lead to problems.
charleski is offline   Reply With Quote