Skip to content

[css-values] Add the ''lh'' and ''rlh'' units #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions css-values/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,10 @@ Relative lengths</h3>
as represented by the “水” (CJK water ideograph, U+6C34) glyph
<tr><td>''rem''
<td>font size of the root element
<tr><td>''lh''
<td>line height of the element
<tr><td>''rlh''
<td>line height of the root element
<tr><td>''vw''
<td>1% of viewport's width
<tr><td>''vh''
Expand Down Expand Up @@ -913,14 +917,19 @@ Relative lengths</h3>
-->

<h4 id="font-relative-lengths">
Font-relative lengths: the ''em'', ''ex'', ''ch'', ''ic'', ''rem'' units</h4>
Font-relative lengths: the ''em'', ''ex'', ''ch'', ''ic'', ''rem'', ''lh'', ''rlh'' units</h4>

Aside from ''rem'' (which refers to the font-size of the root element),
Aside from ''rem'' (which refers to the font-size of the root element)
and ''rlh'' (which refers to the line-height of the root element),
the <dfn export id="font-relative-length">font-relative lengths</dfn> refer to the font metrics of the element on which they are used.
The exception is when they occur in the value of the 'font-size' property itself,
in which case they refer to the computed font metrics of the parent element
(or the computed font metrics corresponding to the initial values of the 'font' property,
if the element has no parent).
In addition, if the ''lh'' unit is used in the value of the 'line-height' property,
it also refer to the computed metrics on the parent element
(or the computed metrics corresponding to the initial values of the 'font' and 'line-height' properties,
if the element has no parent).

<dl export dfn-type=value dfn-for="<length>">
<dt><dfn id="em" lt="em">em unit</dfn>
Expand Down Expand Up @@ -996,6 +1005,24 @@ Font-relative lengths: the ''em'', ''ex'', ''ch'', ''ic'', ''rem'' units</h4>
Equal to the computed value of 'font-size' on the root element.
When specified on the 'font-size' property of the root element,
the ''rem'' units refer to the property's <em>initial value</em>.
<dt><dfn id="lh" lt="lh">lh unit</dfn>
<dd>
Equal to the computed value of the 'line-height' property of the element on which it is used,
converted to an absolute length.

<dt><dfn id="rlh" lt="rlh">rlh unit</dfn>
<dd>
Equal to the computed value of 'line-height' property on the root element,
converted to an absolute length.
When specified on the 'font-size' or 'line-height' properties of the root element,
the ''rlh'' units refer to the properties' <em>initial value</em>.

Note: setting the 'height' of an element using either the ''lh'' or the ''rlh'' units
does not enable authors to control the actual number of lines in that element.
These units only enable length calculations based on the theoretical size of an ideal empty line;
the size of actual lines boxes may differ based on their content.
In cases where an author wants to limit the number of actual lines in an element,
the 'max-lines' property shall be used instead.
</dl>

<!--
Expand Down Expand Up @@ -2273,7 +2300,7 @@ Changes</h2>
Changes since <a href="http://www.w3.org/TR/css-values-3/">Level 3</a>:

<ul>
<li>Added the ''vi'', ''vb'', and ''ic'' units.
<li>Added the ''vi'', ''vb'', ''ic'', ''lh' and ''rlh'' units.
</ul>

<h2 class="no-num" id="sec-pri">
Expand Down