Re: Line layout in browsers

Ben Cotterell wrote:

>> 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.
>
> Why? At least some fonts have some sort of suggested "line gap" stored
> in them.

Yes, but are browsers allowed to peek at such information and use it?

> The browser could do worse than base line-height: normal on that (I
> would have assumed that's what they did do).

I don't think they do. Using different fonts, the default (normal) 
line-height seems to remain the same, depending just on the font size.

But reading the specs again, I must admit that it can be construed as 
allowing, maybe even suggesting, that the meaning of normal depends on 
the font characteristics. The value normal is defined or described as 
follows in the CSS 2.1 draft:

"Tells user agents to set the used value to a "reasonable" value based 
on the font of the element. The value has the same meaning as <number>. 
We recommend a used value for 'normal' between 1.0 to 1.2."

This is somewhat odd: the initial value is by definition normal, but its 
meaning may vary by browser _and_ by font family.

> Or are you saying just that authors have come to expect line-height:
> normal to be a constant for all fonts?

Probably most authors have little idea of the whole line-height issue, 
judging from the generally poor and typically defaulted line spacing on 
web pages. But I would expect that authors who have thought about the 
issue expect it to be a browser-dependent constant (the same for all 
fonts) somewhere in the range 1.1 to 1.2.

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

Received on Wednesday, 23 January 2008 09:40:18 UTC