Re: vertical-align (5.4.4)
Hakon Lie wrote:
> It isn't. 'font-size' applies to all elements. Also, since percentage
> values on 'vertical-align' are relative to 'line-height', replaced
> inline elements need the 'line-height' property as well. So,
> 'line-height' should apply to all elements.
But section 4.4 implies otherwise: "All elements other than replaced
elements have a 'line-height' property...". I had written a message
arguing your point, then deleted it after considering that replaced
elements must sit on the parent's baseline to conform to HTML default
behavior. So the treatment of an inline replaced element would still
contradict general behavior in some way.
But maybe there is a way to keep inline replaced elements more
consistent with other inline elements, and that is to consider
'line-height' to be one of the "intrinsic dimensions" of a replaced
element, and assume it to be the height of the element itself. The spec
should then be modified as follows:
4.3 Replaced elements:
Add "When the 'line-height' property of a replaced
element is not intrinsic to the replaced element it
will be assumed to be equal to the 'height' property
of the element. When 'font' and 'text' properties
are not intrinsic to the replaced element they will
be considered undefined."
4.4 The height of lines:
Strike "other than replaced elements".
5.4.4 'vertical-align': Add <baseline-offset> to values.
Change "if the element doesn't have a baseline" to
"if the element's baseline is undefined".
5.4.8 'line-height': Strike "except replaced elements".
6.1 Length units:
Change the fifth paragraph to read
"The relative units 'em' and 'ex' are relative to the
font size of the element itself, except in the cases
where these values are applied to the element's
'font-size' or where 'font-size' is undefined. In
these cases, 'em' and 'ex' refer to the font-size
of the parent element."
The benefits of these changes:
(1) Eliminate the contradiction between section 4.3 and 'font'
properties that state values are inherited.
(2) Eliminate two exceptions where treatment of replaced inline
elements does not correspond with normal behavior.
(3) Allow easy sizing and positioning of replaced inline elements
relative to the parent. (Note that with these changes, explicitly
setting 'font' and 'font-size' for an inline replaced element will
cause the baseline to become defined, and thereby change the vertical
position of the element on the line. Also note that explicitly setting
line-height could cause previous and subsequent lines of text to
overlap the replaced element -- another useful capability that would
otherwise require negative margins on the inline element.)