Thread: <body> style
View Single Post
Old 04-01-2013, 03:58 PM   #8
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Quote:
Originally Posted by JSWolf View Post
This is the cleaned up code...

Code:
body {
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
}
margin-top and margin-bottom can be better in the @page declaration rather than in body.

The difference is subtle but significant:

If set in body then margins only apply to the top and bottom of the text file being rendered, (typically a chapter), and NOT to the screen of the device. This means that if the text is longer than one screenful on the device, (and a chapter usually is), then you'll lose top margin as you forward through the chapter and the bottom margin will only show once the end of the chapter is displayed.

So if you want the vertical margins to persist as you scroll/page through a chapter then use @page for top/bottom.

(I think that this may also be why calibre uses @page in this way on conversions.)
Agama is offline   Reply With Quote