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

RE: [css21] line-height, problem?

From: Stephen Zilles <szilles@adobe.com>
Date: Mon, 26 Nov 2012 17:59:49 -0800
To: Andrew Fedoniouk <news@terrainformatica.com>
CC: "www-style@gtalbot.org" <www-style@gtalbot.org>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <CE2F61DA5FA23945A4EA99A212B157957193C4DA98@nambx03.corp.adobe.com>
See inline comments:

Steve Z.

-----Original Message-----
From: a.fedoniouk@gmail.com [mailto:a.fedoniouk@gmail.com] On Behalf Of Andrew Fedoniouk
Sent: Monday, November 26, 2012 4:36 PM
To: Stephen Zilles
Cc: www-style@gtalbot.org; www-style@w3.org
Subject: Re: [css21] line-height, problem?

Consider these two properties:

'min-height' specifies the minimal height [of an element].
SZ: elements are (normally) either blocks or inlines (but not lines) and 'min-height' does not apply to non-replaced inline elements (e. g., text)
'line-height' specifies the minimal height of line boxes.
SZ: 'line-height' may be misleading because its practical use (on inline elements or individual glyph clusters) is to specify how much "leading" (i.e. extra space above and below the individual glyphs) will be applied to each glyph. [Note that glyphs in a given line may come from different fonts, with different font-sizes and different alignments within the line.] The CSS rules insure that each of these individual "leading" applications is taken into account when computing the height of the line that contains them. 

Seems like both define same concept - they constrain the height to a certain minimal value that computed value of height may use.
SZ: The key difference (which is endemic to CSS) is that text (and the elements that contain it)  is not treated the same way as other elements. For example, the margins, borders and padding (in the block progression direction) are not considered in determining the line-height of a line that contains such elements (or parts thereof). In addition, the height of the text comes from 'font-size' and not 'height'.  So, from early on, CSS has had different properties for sizing text and lines of text. It is, likely, too late to consider a change to that structure.

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.
SZ: because 'line-height' defines the "leading" that is added  to (or subtracted from) the size of the text. Saying the using 'line-height' on a block sets a minimal line size is more of an observation than a definition. It sets a minimal line size because each line gets a "strut" of zero width that participates in the determination of the height of that line. If the other content of that line is bigger than the strut, then the line will be tall enough to contain the other content. If the other content is smaller than the strut (e.g., when that content is contain in a span with a smaller line-height) then the strut determines the height of the line.

But both use the same concept of minimal constrain, no?
SZ: No, see above.

Andrew Fedoniouk.


On Mon, Nov 26, 2012 at 4:12 PM, Stephen Zilles <szilles@adobe.com> wrote:
> Andrew,
> My understanding of the text that you reference is that minimal means that no line within the block will have a line height of less than the line-height of the block. It seems to me that your test case shows exactly that. Did you have something else in mind?
> Steve Zilles

> -----Original Message-----
> From: a.fedoniouk@gmail.com [mailto:a.fedoniouk@gmail.com] On Behalf 
> Of Andrew Fedoniouk
> Sent: Monday, November 26, 2012 4:01 PM
> To: www-style@gtalbot.org
> Cc: www-style@w3.org
> Subject: Re: [css21] line-height, problem?
> Hmm, seems like my understanding of word "minimal" is completely wrong.
> Consider this very simple doc:
> https://dl.dropbox.com/u/14981836/line-height-test-min.htm
> At the moment the spec[1] says:
> "On a block container element whose content is composed of inline-level elements, 'line-height' specifies the minimal height of line boxes within the element."
> But UAs render this example as if 'line-height' specifies not the minimal height but just height of line boxes.
> Either spec is wrong with use of "minimal" there or UAs are wrong all together.
> [1] http://www.w3.org/TR/CSS21/visudet.html#propdef-line-height
Received on Tuesday, 27 November 2012 02:00:22 UTC

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