I think that every unit, between em, px and %, has its advantages and drawbacks. Everywhere you have to compromise more or less.
Yes px margins are not perfect. Some drawbacks have been signalled, mainly
if you apply big changes in font-size. But, for other reasons, this also exists for em. If it was perfect, why should have people invented rem? px is just an acceptable choice for margins, not worth making a fuss.
I use Prince PDF to convert specially prepared ePub to 9×12 PDF. I use my custom font (slightly darkened), with excellent typography (crengine for koreader suffers from some CSS glitches). I am fastidious enough to spend between 30 minutes to one hour (for complex books) to first rebuild any book I intend to read my way. But, then, I really enjoy reading them. I know it can't be a generic approach but it's mine.
small images: using %
Sometimes however, I like to use % instead of pixels. If I use px for margins, I prefer using % for image display (full page images are not concerned here: I use svg wrappers for them). For smaller images, there are several solutions:
- use pixels and let the renderer do its job, which it will do -hopefully. However you have also to take into account the size of the images, which can be pretty tedious.
- using max-width values just prevent some mishaps but cannot apply for all images.
- I chose to add
individual width percentage to inline style*. I use an unpublished plugin which prorates automatically the percentage width of all these images (and adds "height: auto") for a 3/4 ratio. The display is excellent for all devices with this shape (ex: 600/800). It's not universal though: in landscape mode, for exotic shapes of screen, it does not fit so well. This is the price of the compromise. But, thanks to this, the display of images on my PDF is pretty good.It's a quick and dirty solution and very handy for me (just one click away for
all smaller images). Feel free to disagree.
*
to get the highest CSS priority
poetry
As far as poetry is concerned, I certainly do not pretend having found the solution. The one presented here just can help for one use case but poetry offers myriads of them which require other specific solutions, and even then...