If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

CSS line-height is not inherited properly except in P

RESOLVED INVALID

Status

()

Core
Layout
RESOLVED INVALID
14 years ago
14 years ago

People

(Reporter: T. Chan, Unassigned)

Tracking

Trunk
PowerPC
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.7
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040531 Firefox/0.8.0+

When line-height is specified with font-size, results are as predicted. When line-height is inherited, it 
uses the line height calculated previously. This means if a document specifies a default line-height and 
then changes it in a <div> or <TH>, it looks wrong.

This renders predictably:
<div style="line-height: 1.1em; font-size: 3em;">A<BR>B<BR>C</div>

This does not:
<div style="line-height: 1.1em;"><div style="font-size: 3em;">A<BR>B<BR>C</div></div>

Enclosing the text in <P></P> instead works properly, but this is not suitable for tables since it leaves 
huge spaces before and after the paragraph (the table in question uses line-height: 1.5 em).

Adding line-height to every <TD> and <TH> is not suitable, since it's a function of the style sheet and, 
if anything, should be inherited correctly. line-height is not inherited properly anyway, since BODY { 
line-height: 2 em } doesn't change the spacing in the table, but TD { line-height: 2 em } does (unless 
TD doesn't inherit line-height, which means it should make the row taller to accomodate font-size)).

Also verified on Windows Mozilla (not the latest version though).

Reproducible: Always
Steps to Reproduce:
1. View the related URL (and the table in http://en.wikipedia.org/wiki/Quotation_mark#Straight_quotes 
)
It's pretty clear in the spec that what we do is right.  You generally want to
use numbers for line-heights rather than lengths.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
(The site stylesheet has a 'line-height: 1.5em' in rules matching both #content
(which matters here) and p (which doesn't).)
(Reporter)

Comment 3

14 years ago
(In reply to comment #1)
> It's pretty clear in the spec that what we do is right.  You generally want to
> use numbers for line-heights rather than lengths.

Where does it say that?
See the definition of computed values:
http://www.w3.org/TR/2004/CR-CSS21-20040225/cascade.html#computed-value

then the definition of inheritance (elements inherit computed values):
http://www.w3.org/TR/2004/CR-CSS21-20040225/cascade.html#inheritance

and specifically what the computed value of 'line-height' is:
http://www.w3.org/TR/2004/CR-CSS21-20040225/about.html#q13
http://www.w3.org/TR/2004/CR-CSS21-20040225/visudet.html#propdef-line-height
You need to log in before you can comment on or make changes to this bug.