Re: line-height limitations

On Mar 17, 2011, at 9:21 AM, Brad Kemper wrote:

> 
> On Mar 17, 2011, at 1:01 AM, David Woolley wrote:
> 
>> Andrew Fedoniouk wrote:
>>>     p { font-size:12pt;
>>>         line-height:12pt;
>> 
>>> If “yes” then why it cannot be used?
>> 
>> Setting line-height to anything but a pure number tends to cause consecutive lines to overlap when consumers disable font sizes and cap the minimum size.  This is often necessary because authors choose excessively small sizes.
> 
> It looks to me like setting line-height to a number is the only case where David's problem exists. When using ems or percent, the first line or first  letter or whatever inherits the length that was set on the block, which is based on the font size of the block. But when using numbers, the number is multiplied by the font size of the pseudo-element.
> 
> So in the limited case of David's stated problem, it does not sound like we need a new property. Instead, the problem can be easily solved by using ems for the line-height.


I suppose the rule would be something like:

::first-line * { line-height:1em }

And you're right that would work.  You would lose some extra spacing above the ascent from discarding the built-in line spacing of the larger font though, although you would lose that with a "glyphs" value of line-box-contain as well.

I think my preference still would be for

* { line-box-contain: block glyphs replaced; }

over first-line though, since I have a distaste for first-line because of its negative performance and footprint implications.

dave
(hyatt@apple.com)

Received on Friday, 18 March 2011 16:58:05 UTC