W3C home > Mailing lists > Public > www-style@w3.org > November 2012

Re: [css21] line-height, problem?

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 26 Nov 2012 10:51:43 -0800
Message-ID: <CALRQH7_9rnwi5+62fEsw3ec2hhsaHrOjEGtQRNVMCHisPifrqA@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: www-style@w3.org
On Mon, Nov 26, 2012 at 12:14 AM, L. David Baron <dbaron@dbaron.org> wrote:
> On Sunday 2012-11-25 23:21 -0800, Andrew Fedoniouk wrote:
>> This sample:
>> https://dl.dropbox.com/u/14981836/line-height-test.htm
>> contains two identical paragraphs, the only difference is that
>> first one has line-height:normal and second one - line-height:1em;
>> According to the spec [1]:
>>    'line-height' specifies the *minimal* height of line boxes within
>> the element.
>> I suspect that I miss something between lines of the spec.
>> My understanding of the spec wording is this:
>> used-line-height = max( {normal-line-height}, {defined-line-height} );
> (1) when you're testing line-height, you should really test
> standards mode rather than quirks mode; quirks mode behavior is
> substantially different (and not fully explained by the first two
> items in http://quirks.spec.whatwg.org/#css ).
> (2) 'normal' and '1em' are *very* different in terms of how they
> inherit when the font size changes (since '1em' inherits as the
> computed value, which is no longer relative to the changed
> descendent font size).  'normal' and '1' are much more similar.
> -David

Thanks, David. I've updated the sample with HTML5 doctype.
That actually makes no difference (only IE started to match
all other UAs here).

In fact I've missed that part in the spec:
"On a non-replaced inline element, 'line-height' specifies the height
that is used in the calculation of the line box height."

So for such elements (like <big> in my sample) line-height defines
not "min-line-height" but just 'line-height' allowing to reduce it.
Together with the fact that line-height is an inheritable property
that creates such strange effect.

Actually it is a bug in spec design: if property is inheritable then
it shall not change meaning on child (min-line-height to line-height

Andrew Fedoniouk.

Received on Monday, 26 November 2012 18:52:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:23 UTC