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

Re: [css21] line-height, problem?

From: Alan Gresley <alan@css-class.com>
Date: Tue, 27 Nov 2012 16:52:02 +1100
Message-ID: <50B45502.3090406@css-class.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
CC: "www-style@w3.org" <www-style@w3.org>
On 27/11/2012 3:10 PM, Andrew Fedoniouk wrote:
> On Mon, Nov 26, 2012 at 5:00 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Mon, Nov 26, 2012 at 4:35 PM, Andrew Fedoniouk
>> <news@terrainformatica.com> wrote:
>>> Consider these two properties:
>>> 'min-height' specifies the minimal height [of an element].
>>> 'line-height' specifies the minimal height of line boxes.
>>> Seems like both define same concept - they constrain the height to a
>>> certain minimal value that
>>> computed value of height may use.
>>> By defining min-height you *cannot* make elements smaller, only larger.
>>> But by defining line-height you can make line-box smaller than its content.
>> I'm confused.  You just stated completely different things.
>> The line box never grows smaller than the largest line-height of the
>> box fragments on the line.  That's the same sense of "minimal" that
>> min-height gives to a box.
> I don't understand "never grows smaller than ..." statement, something
> inside me cries about such language construct.

Well if this construct wasn't present as a default, then you could have 
overlap of glyphs. Since we can use glyphs of different fonts, the 
line-height is set by the font that has the largest line-height and the 
fonts that have a smaller line-height are vertically lowered so the 
baseline is the same across all fonts appearing in a line box.

A quick test case (assure that the viewport is wide enough so their is 
only one line):


Now narrow the viewport so you have two lines and retest. You would 
hopefully had noticed that the since a new line has appeared, it is only 
that line box on the new line that changes and this is what Tab is 
saying here.

 >> The line box never grows smaller than the largest line-height of the
 >> box fragments on the line.

[snipped the remainder since you have a new message]

Alan Gresley
Received on Tuesday, 27 November 2012 05:52:35 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:22 UTC