Skip to content

Commit c46c661

Browse files
committed
[css-values] Define the concept of compatible and canonical units, and define canonical units for all relevant types.
1 parent 5f598ec commit c46c661

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

css-values/Overview.bs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Abstract: This CSS3 module describes the common values and units that CSS proper
2424
At Risk: ''toggle()'', ''attr()''
2525
Ignored Terms: <spacing-limit>, containing block
2626
Ignored Vars: Cn+1, n
27+
Inline Github Issues: yes
2728
</pre>
2829
<pre class='link-defaults'>
2930
spec: css-backgrounds-3; type: type; text: <position>
@@ -797,6 +798,15 @@ Numbers with Units: <a>dimensions</a></h3>
797798
resolutions (<<resolution>>),
798799
and other quantities.
799800

801+
When serializing <a lt="computed value">computed</a> and <a>used values</a>,
802+
<dfn export local-lt=compatible>compatible units</dfn>
803+
(those related by a static multiplicative factor,
804+
like the 96:1 factor between ''px'' and ''in'',
805+
or the 1000:1 factor between ''ms'' and ''s'')
806+
are converted into a single <dfn export local-lt=canonical>canonical unit</dfn>.
807+
Each group of compatible units defines which among them is the <a>canonical unit</a>
808+
that will be used for serialization.
809+
800810
<!--
801811
██ ████████ ██ ██ ██████ ████████ ██ ██
802812
██ ██ ███ ██ ██ ██ ██ ██ ██
@@ -1055,11 +1065,15 @@ Absolute lengths: the ''cm'', ''mm'', ''q'', ''in'', ''pt'', ''pc'', ''px'' unit
10551065
</pre>
10561066
</div>
10571067

1068+
All of the absolute length units are <a>compatible</a>,
1069+
and ''px'' is their <a>canonical unit</a>.
1070+
10581071
For a CSS device, these dimensions are anchored either
1059-
<ul>
1060-
<li>(i) by relating the <a>physical units</a> to their physical measurements, or
1061-
<li>(ii) by relating the <a value>pixel unit</a> to the <a>reference pixel</a>.
1062-
</ul>
1072+
1073+
<ol type=i>
1074+
<li>by relating the <a>physical units</a> to their physical measurements, or
1075+
<li>by relating the <a value>pixel unit</a> to the <a>reference pixel</a>.
1076+
</ol>
10631077

10641078
For print media and similar high-resolution devices,
10651079
the anchor unit should be one of the standard physical units (inches, centimeters, etc).
@@ -1175,6 +1189,9 @@ Angle Units: the <<angle>> type and ''deg'', ''grad'', ''rad'', ''turn'' units</
11751189
For example, a right angle is ''90deg'' or ''100grad'' or ''0.25turn'' or
11761190
approximately ''1.57rad''.
11771191

1192+
All <<angle>> units are <a>compatible</a>,
1193+
and ''deg'' is their <a>canonical unit</a>.
1194+
11781195
<div class="note">
11791196
By convention,
11801197
when an angle denotes a direction in CSS,
@@ -1211,6 +1228,9 @@ Duration Units: the <<time>> type and ''s'', ''ms'' units</h3>
12111228
<dd>Milliseconds. There are 1000 milliseconds in a second.
12121229
</dl>
12131230

1231+
All <<time>> units are <a>compatible</a>,
1232+
and ''s'' is their <a>canonical unit</a>.
1233+
12141234
Properties may restrict the time value to some range.
12151235
If the value is outside the allowed range,
12161236
the declaration is invalid and must be <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
@@ -1241,6 +1261,9 @@ Frequency Units: the <<frequency>> type and ''Hz'', ''kHz'' units</h3>
12411261
For example, when representing sound pitches, 200Hz (or 200hz)
12421262
is a bass sound, and 6kHz (or 6khz) is a treble sound.
12431263

1264+
All <<frequency>> units are <a>compatible</a>,
1265+
and ''hz'' is their <a>canonical unit</a>.
1266+
12441267
<!--
12451268
████████ ████████ ██████ ███████
12461269
██ ██ ██ ██ ██ ██ ██
@@ -1273,6 +1296,11 @@ Resolution Units: the <<resolution>> type and ''dpi'', ''dpcm'', ''dppx'' units<
12731296
For uses, see e.g. the ''resolution'' media query in [[MEDIAQ]]
12741297
or the 'image-resolution' property defined in [[CSS3-IMAGES]].
12751298

1299+
All <<resolution>> units are <a>compatible</a>,
1300+
and ''dpi'' is their <a>canonical unit</a>.
1301+
1302+
Issue(178):
1303+
12761304
Note: Due to the 1:96 fixed ratio of CSS ''in'' to CSS ''px'',
12771305
''1dppx'' is equivalent to ''96dpi''.
12781306
This corresponds to the default resolution of images displayed in CSS: see 'image-resolution'.

0 commit comments

Comments
 (0)