View Single Post
Old 09-03-2022, 05:45 AM   #15
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,164
Karma: 105212035
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by jhowell View Post
My understanding is that the "width" and "height" attributes for an "img" element in HTML 5 only allow an integer value without a unit.
I'd only have width" and "height" attributes for an "img" in CSS, never in the actual HTML. That is "automatic" when converting docx to epub2 in Calibre. All the regular types of unit work. Also auto on height OR width if the other value is set. Obviously the result rendering CSS with say 80% width and auto height may only make sense in portrait and actual size may depend on the scope of anything enclosing the HTML where the CSS is used. Curiously px isn't always exactly pixels. Some units never make sense (like physical size).

This Wikipedia extract is inaccurate:
Quote:
Some units – cm (centimetre); in (inch); mm (millimetre); pc (pica); and pt (point) – are absolute, which means that the rendered dimension does not depend upon the structure of the page; others – em (em); ex (ex) and px (pixel)[clarification needed] – are relative, which means that factors such as the font size of a parent element can affect the rendered measurement.
Many renderers use 12pt = 1em, though kepub rather than epub on Kobo seems to use a non-standard conversion.
px is not always a physical pixel

I think cm (centimetre), in (inch) and mm (millimetre) should only be used in media Paper/Print. They make no sense on webpages or ebooks on screens.
The pc (pica) is obsolete. Use em or if converting from docx to epub or html use pt (point) if the WP styles don't allow em.

We use pt (and for images only % and px) for docx styles for ebooks and the copy docx for PDF export uses mm for page sizes, margins, padding, images etc.

Never use px or mm etc etc for font sizes, only em or pt.
Quoth is offline   Reply With Quote