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

RE: Line layout in browsers

From: Sergey Malkin <sergeym@windows.microsoft.com>
Date: Mon, 21 Jan 2008 16:19:07 -0800
To: David Hyatt <hyatt@apple.com>, "Eric A. Meyer" <eric@meyerweb.com>, CSS <www-style@w3.org>
Message-ID: <E30895F8BA39B6439F5F1AAA1DBBFB524710A74361@NA-EXMSG-W602.wingroup.windeploy.ntdev.microsoft.com>

In typography, when you want to control line spacing, you usually set font size and additional leading independently, directly in points. InDesign does not even provide option to set line height in percentage to anything. If it is for documents with dynamic font size, like Web pages, having it as percentage of 1em will have exactly the same meaning as absolute value in points.

Default value from the font is only a default. You usually won't play with it, but if you do that means you are entering higher-level typographic area where you know what you are doing. You may need to know what font you are using, because there will be factors beyond default line height you will have to take into account. Different aspects of typeface design, like x-height, overall color, will affect your decision.

On the other hand, if somebody really wants to set line height as a percent of default font value, it can be added to the list of length units along with em and ex. Can I say "line-height:1.5lh", then?


-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of David Hyatt
Sent: Monday, January 21, 2008 12:57 PM
To: Eric A. Meyer
Subject: Re: Line layout in browsers

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.


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 Tuesday, 22 January 2008 00:19:26 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:33 UTC