Re: line-height limitations

On Mar 18, 2011, at 3:37 PM, David Hyatt <hyatt@apple.com> wrote:

> On Mar 18, 2011, at 5:08 PM, Brad Kemper wrote:
> 
>> On Mar 18, 2011, at 9:57 AM, David Hyatt <hyatt@apple.com> wrote:
>> 
>>>> 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.
>> 
>> Actually, what I meant is to change the UA stylesheet, so if, for example, it currently has this:
>> 
>> p { line-height:1.2; }
>> 
>> then instead you change it to this:
>> 
>> p { line-height:1.2em; }
>> 
>> Does this not fix the problem with little or no negative repercussions?
> 
> In addition to what David Baron said already, this also assumes you want to set an explicit line-height.  If you want to just use the font's built-in line spacing, then setting explicit values is a problem.

Is that a big need or issue? I didn't even realize that was possible. CSS2.1 says that the initial value of line-height is 'normal', which is a "reasonable" number that the UA chooses, and is recommended to be between 1.0 and 1.2. Are you getting it from the font?

In any event, I've been using ems for paragraph line-height for years, to get a value that I consider reasonable. I never had problems resulting from that choice. If I did set a larger font size on a span in the middle somewhere, and actually felt that having a big gap under the letters was preferable to letting the defenders overlap next lines (highly doubtful, and unlikely to be a problem unless line-height is low and descenders are long), then I could always set the line-height of the span to something else, using the same selector that changed it's size.

Received on Friday, 18 March 2011 23:27:59 UTC