Skip to content

Commit c42ab51

Browse files
frivoalfantasai
authored andcommitted
[css-values] Add the ''lh'' and ''rlh'' units
Resolution in https://lists.w3.org/Archives/Public/www-style/2016Aug/0009.html
1 parent 4480d6c commit c42ab51

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

css-values/Overview.bs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,10 @@ Relative lengths</h3>
884884
as represented by the “水” (CJK water ideograph, U+6C34) glyph
885885
<tr><td>''rem''
886886
<td>font size of the root element
887+
<tr><td>''lh''
888+
<td>line height of the element
889+
<tr><td>''rlh''
890+
<td>line height of the root element
887891
<tr><td>''vw''
888892
<td>1% of viewport's width
889893
<tr><td>''vh''
@@ -913,14 +917,19 @@ Relative lengths</h3>
913917
-->
914918

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

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

925934
<dl export dfn-type=value dfn-for="<length>">
926935
<dt><dfn id="em" lt="em">em unit</dfn>
@@ -996,6 +1005,24 @@ Font-relative lengths: the ''em'', ''ex'', ''ch'', ''ic'', ''rem'' units</h4>
9961005
Equal to the computed value of 'font-size' on the root element.
9971006
When specified on the 'font-size' property of the root element,
9981007
the ''rem'' units refer to the property's <em>initial value</em>.
1008+
<dt><dfn id="lh" lt="lh">lh unit</dfn>
1009+
<dd>
1010+
Equal to the computed value of the 'line-height' property of the element on which it is used,
1011+
converted to an absolute length.
1012+
1013+
<dt><dfn id="rlh" lt="rlh">rlh unit</dfn>
1014+
<dd>
1015+
Equal to the computed value of 'line-height' property on the root element,
1016+
converted to an absolute length.
1017+
When specified on the 'font-size' or 'line-height' properties of the root element,
1018+
the ''rlh'' units refer to the properties' <em>initial value</em>.
1019+
1020+
Note: setting the 'height' of an element using either the ''lh'' or the ''rlh'' units
1021+
does not enable authors to control the actual number of lines in that element.
1022+
These units only enable length calculations based on the theoretical size of an ideal empty line;
1023+
the size of actual lines boxes may differ based on their content.
1024+
In cases where an author wants to limit the number of actual lines in an element,
1025+
the 'max-lines' property shall be used instead.
9991026
</dl>
10001027

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

22752302
<ul>
2276-
<li>Added the ''vi'', ''vb'', and ''ic'' units.
2303+
<li>Added the ''vi'', ''vb'', ''ic'', ''lh' and ''rlh'' units.
22772304
</ul>
22782305
22792306
<h2 class="no-num" id="sec-pri">

0 commit comments

Comments
 (0)