The user can change the font size and the line spacing and side margins.
Users have very different sizes of screens from less than 4″ to more than 14″.
So you have no idea how many "lines" a page has.
In general you can't do much about bottom margins.
The only 100% way to force a page break and have a top of page spacing for a header is to have that header as the 1st item in a file. Then you need padding-top: 3em; if you want the space to be twice the size of a 1.5em font in the heading.
Many ereaders will discard a margin-top on the first item on a page.
Many ereaders will discard a margin-bottom on the last item on a page.
Windows and Orphans is a minimum of 1. That causes stuff to jump from one page to another if more than 1 on occasion.
There are page-break directives that can work, but the only sure way of knowing if something is at the top of a page is the start of a new file.
Assume the main body font is 1em (12pt). That can even be set. Then if a heading is set to 1.5em (or 18pt), then it will be 1.5x taller, if the same font. Different fonts may vary in size.
You do not set line-height. The relative line-height is automatic from the font.
So depending on the user resizing the font all the vertical margins and vertical padding and line spacing change proportionally.
The main outer margin should be zero. Then the user sets that margin as desired. It will not be zero.
Don't set left or right if an item is centred (spelled center because CSS is using American spelling only).
|