View Single Post
Old 08-14-2011, 05:56 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,161
Karma: 60406498
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by sciurius View Post
For a particular book, I have a style sheet that defines:

p {
font-family: Arial, "sans-serif";
font-size: 21pt;
margin-left: 2.7em;
margin-right: 2.7em;
text-align: left;
}

I also have a version with smaller font size:

p {
font-family: Arial, "sans-serif";
font-size: 18pt;
margin-left: 5.1em;
margin-right: 5.1em;
text-align: left;
}

In either version, the word breaks of the text are at exactly the same places. In other words, the page looks exactly the same in both versions except for the size (and margins).

To make the style settings independent of the font size, I want to use max-width instead of margin-right. Some experimenting reveals that I have to use max-width: 26.4em for the 21pt version, and 26.9em for the 18pt version. This is surprising, since I'd expect exactly the same value for both versions. max-width is expressed in terms of em so it should be independent of the font size. 0.5em difference is just too much to ignore.

What am I missing in the calculations?
Margins should probably be a fixed size value (not in em) to avoid different margins with different fonts or (user) scaling.
theducks is online now   Reply With Quote