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

Re: Line layout in browsers

From: David Hyatt <hyatt@apple.com>
Date: Mon, 21 Jan 2008 14:56:34 -0600
To: "Eric A. Meyer" <eric@meyerweb.com>
Cc: CSS <www-style@w3.org>
Message-id: <ABC5315C-B9C5-4988-A67D-4E7604AC4833@apple.com>

One additional point I should make here is that I actually hate the  
fact that 100% and 1 are not the same as 'normal' for line-height.  If  
I'd been designing it, I'd have made 100% and 1 be multiples of the  
computed normal line-height and not of the font-size.  The 'em' unit  
already exists to allow for line-heights as multiples of the font  
size, but there is absolutely no way in CSS to make the line-height a  
multiplier of the 'normal' height.

dave
(hyatt@apple.com)

On Jan 21, 2008, at 2:50 PM, David Hyatt wrote:

>
> On Jan 21, 2008, at 2:38 PM, David Hyatt wrote:
>
>>
>>
>> On Jan 21, 2008, at 2:25 PM, Eric A. Meyer wrote:
>>
>>>
>>> At 5:18 PM -0800 1/17/08, Alex Mogilevsky wrote:
>>>
>>>>>   * Conversely, the borders overlap in Explorer and Firefox at  
>>>>> '1',
>>>>> but get close to touching at '1.2'.  Which again seems backwards.
>>>>
>>>> '1' is normally less than default line height defined by font. So  
>>>> span borders (which are drawn around actual character boxes) will  
>>>> overlap. What is unexpected there?
>>>
>>> Wait, what?  The last I checked, the height of a line is based on  
>>> the computed 'font-size' of an element.
>
> What Alex is saying is that the default value of "normal" for line- 
> height results in the browser using the line height that is built  
> into the font itself. That value, if viewed as a multiple of the  
> font size, is almost always > 1 (and usually closer to 1.2).   
> Picking '1' as your explicit line-height is typically going to  
> result in lines that are pretty close together, since you've  
> effectively eliminated the gaps between lines (making it possible  
> for a character with  a large descent to touch a character on the  
> next line with a large ascent).  Therefore building additional  
> height into any spans on the line through the use of border/padding  
> is going to pretty much guarantee an overlap of those boxes.
>
> dave
> (hyatt@apple.com)
>
>
Received on Monday, 21 January 2008 20:56:50 GMT

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