Reputation: 4018
According to the specification vertical-align
property in percentage is relative to line-height
property of the element itself. So I made a test and in Chrome Dev Tools the computed value is not present in pixels like in Firefox and IE11. This behavior is weird and I wonder is this a bug or ? I know that all other values in Chrome are computed to pixels and it's odd that vertical-align
is not computed to pixels.
Here is the test http://jsfiddle.net/blaja/r5m2yc7e/
Upvotes: 2
Views: 426
Reputation: 723388
The propdef for vertical-align
indeed says that values specified as percentages must be computed to an absolute length based on the line height, i.e. a pixel value. Depending on whether the browser definition of "computed value" is supposed to be consistent with the CSS definition, this may or may not be a bug per se.
For that matter, all three browsers appear to be incorrectly computing line-height
to an absolute value as well. The spec says if the specified value is a number, not a length, then the computed value is the same as the specified value; it should not resolve to an absolute length unless it is specified as such (or as a percentage). In your case, line-height
is specified on the p
element as 1.5
. This same value should be inherited by the span
, then used in calculating the exact line height needed to render the line box(es). The resultant line height is the used value, not the computed value.
Upvotes: 2