View Full Version : Units of measurement


Ti-Ron
09-26-2012, 11:32 AM
What is the best way to keep a proper layout wherever the app, support and user's preferences are.
I know each reader devices and app can change the layout and the user can change almost everything. But I want little control over the proportion like spaces before and after a paragraph or a tiltle. Margin around a table or a pic.

What is the best way to keep them clean: em, px or % ?

Jellby
09-26-2012, 12:03 PM
It depends on what you want. Pixels are almost never a good choice, since they might depend on the device resolution (although strictly, the CSS spec gives them a sort of absolute meaning, but I wouldn't trust the reading applications to be aware of this).

If you want something to depend on the font size (probably indents or vertical spacing), use em.

If you want something to depend on the screen size (maybe some margins), use %; for relative font sizes you can use % too.

If you want something to have some absolute size (some other margins, or line widths, or picture size), use real units, like in or mm.

Whatever you do, you won't be able to "keep a proper layout wherever the app, support and user's preferences are", there will always be an app that messes everything, and users with extreme (or silly) preferences.

mrmikel
09-27-2012, 07:58 AM
You could make it a pdf. It forces exact locations and spacing.

The reflowable nature of epubs and unpredictable interpretations of the epub by reader software makes exact predictions of what will occur at ALL times impossible.

But you trade one set of problems for another.

Ti-Ron
09-27-2012, 11:56 AM
@mrmikel: thanks for the input! In facts, I'm not looking to "force" the layout but have a certain constancy between each reader. I know it's impossible to have the same layout on every plateforms, reading apps...

I'm trying to avoid PDF. I prefer ePub problem over PDF! ;)

Ti-Ron
09-27-2012, 11:57 AM
@Jellby: Thanks for the help. I'Ll try to use those advices for my ePub!

Ti-Ron
09-27-2012, 11:59 AM
...there will always be an app that messes everything, and users with extreme (or silly) preferences.

This makes me laugh. A lot!!!!

Ti-Ron
09-27-2012, 12:52 PM
Ofr padding and borders of a table, wich unite I must use, em or % ?

Jellby
09-28-2012, 05:05 AM
I'd probably use em (changes with font size) or mm (absolute, independent of font and screen sizes). Test the effect in a browser, changing the font and window sizes and decide which behaviour you like best.