W3C home > Mailing lists > Public > www-style@w3.org > January 2008

Re: Line layout in browsers

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Tue, 22 Jan 2008 10:10:54 +0200
Message-ID: <002401c85cce$50ce39d0$0500000a@DOCENDO>
To: <www-style@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:58 GMT