Re: Line layout in browsers

Alex Mogilevsky wrote:

> "normal" line height is what font designer decided would be the
> perfect distance between two lines; when represented in EMs it is
> nearly always bigger than one.

You mean "between baselines of text", right?

But in CSS, "normal" is a browser-dependent constant, interpreted with 
em as the implied unit (though inherited as a number, not as computed 
value). I haven't seen anything in CSS specifications and drafts that 
suggests anything else, and they have rather different views on what 
this constant might or should be.

So it has to be decided on a "one size fits all" basis. And authors 
cannot really know what "normal" might mean. This is one reason why 
authors should always set line-height. After all, they normally have 
_some_ font-family setting, and selecting a value that fits _those_ 
fonts reasonably is a better situation for making a good decision than a 
browser designer's decision of selecting an overall "normal" value.

Unless we want to change the effect of existing style sheets in a rather 
surprising (to authors and users) way, the current flawed idea of 
"normal" as an unknown constant should be preserved, and so should the 
principle that a plain number as line-height value has em as the implied 
unit.

This means that to add a more logical way, a new unit is needed. It 
would equal the default line-height for the font of the element; such a 
default would have to be postulated for all fonts, with the idea that it 
is normally taken from the font designer's suggestion. Then people could 
use this unit to specify the line-height as a multiple of it - as people 
currently do (typically without knowing this and without knowing the 
default line-height), when they set line height in Microsoft Word, for 
example.

This would not break existing style sheets, and authors could also 
provide a backup rule for browsers than don't recognize the new unit, 
e.g.

* { line-height: 1.3; } /* for old browsers */
* { line-height: 1.1dlh; } /* for new browsers, 1.1 times default line 
height */

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 

Received on Tuesday, 22 January 2008 08:10:45 UTC