W3C home > Mailing lists > Public > www-style@w3.org > March 2011

Re: line-height limitations

From: David Hyatt <hyatt@apple.com>
Date: Fri, 18 Mar 2011 12:45:54 -0500
Cc: David Woolley <forums@david-woolley.me.uk>, www-style CSS <www-style@w3.org>
Message-id: <C8025A85-8520-4944-B9A0-EA4C635753A7@apple.com>
To: Brad Kemper <brad.kemper@gmail.com>
On Mar 18, 2011, at 11:57 AM, David Hyatt wrote:

> 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 }

Sorry I meant:

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

However the problem with this rule is you lose the built-in line-spacing of the font, and the line spacing becomes too tight.

As Andrew pointed out, you'd need a parent value to really make this work.  Of course line-box-contain works fine... it's just a question of whether or not it's considered overkill for this problem.

Received on Friday, 18 March 2011 17:46:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:57 UTC