css3-values/Overview.html

Wed, 10 Aug 2011 23:44:59 +0000

author
Elika Etemad <fantasai.cvs@inkedblade.net>
date
Wed, 10 Aug 2011 23:44:59 +0000
changeset 3291
8e1babb965e4
parent 3290
7b88d4104083
child 3292
324c6ef7c447
permissions
-rw-r--r--

Generic Datatype Reorganization Part IV: Other Dimension Types
Also, remove various normative bits that are wrong, such as angle normalization.

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
     2 "http://www.w3.org/TR/html4/strict.dtd">
     4 <html lang=en>
     5  <head><meta content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
     7   <title>CSS3 Values and Units</title>
     9   <style type="text/css">
    10     .issue { color: red }
    11     table { border-collapse: collapse; border: 1px solid black; margin: 1em 0 }
    12     th, td { border: 1px solid black; padding: 0.2em; text-align: left }
    13     tt.declaration { white-space: nowrap }
    14     .del { text-decoration: line-through}
    15     .say { font-style: italic }
    16     .value { font: inherit; white-space: pre-wrap; margin: 0; padding: 0; }
    17     #propvalues td { text-align: right; }
    18     #propvalues td + td { text-align: left; }
    19     p { text-indent: 0 !important; margin: 1em 0 !important; }
    20   </style>
    21   <link href="../default.css" rel=stylesheet type="text/css">
    22   <link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
    23   type="text/css">
    25  <body>
    26   <div class=head> <!--begin-logo-->
    27    <p><a href="http://www.w3.org/"><img alt=W3C height=48
    28     src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
    30    <h1 id=css3-template>CSS3 Values and Units</h1>
    32    <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 10 August 2011</h2>
    34    <dl>
    35     <dt>This version:
    37     <dd><a
    38      href="http://www.w3.org/TR/2011/ED-css3-values-20110810/">http://www.w3.org/TR/2011/ED-css3-values-20110810/</a>
    40     <dt>Latest version:
    42     <dd><a
    43      href="http://www.w3.org/TR/css3-values">http://www.w3.org/TR/css3-values</a>
    45     <dt>Previous version:
    47     <dd><a
    48      href="http://www.w3.org/TR/2005/WD-css3-values-20050726">http://www.w3.org/TR/2005/WD-css3-values-20050726</a>
    50     <dt>Editors:
    52     <dd>H&aring;kon Wium Lie, Opera Software &lt;howcome@opera.com&gt;
    54     <dd>Tab Atkins, Google
    56     <dd>Elika J. Etemad, Invited Expert
    57    </dl>
    58    <!--begin-copyright-->
    59    <p class=copyright><a
    60     href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
    61     rel=license>Copyright</a> &copy; 2011 <a
    62     href="http://www.w3.org/"><acronym title="World Wide Web
    63     Consortium">W3C</acronym></a><sup>&reg;</sup> (<a
    64     href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
    65     of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym
    66     title="European Research Consortium for Informatics and
    67     Mathematics">ERCIM</acronym></a>, <a
    68     href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
    69     href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
    70     <a
    71     href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
    72     and <a
    73     href="http://www.w3.org/Consortium/Legal/copyright-documents">document
    74     use</a> rules apply.</p>
    75    <!--end-copyright-->
    76    <hr title="Separator for header">
    77   </div>
    79   <h2 class="no-num no-toc" id=abstract>Abstract</h2>
    81   <p>This CSS3 module describes the various values and units that CSS
    82    properties accept. Also, it describes how values are computed from
    83    "specified" through "computed" and "used" into "actual" values. The main
    84    purpose of this module is to define common values and units in one
    85    specification which can be referred to by other modules. As such, it does
    86    not make sense to claim conformance with this module alone.
    88   <h2 class="no-num no-toc" id=status>Status of this document</h2>
    89   <!--begin-status-->
    91   <p>This is a public copy of the editors' draft. It is provided for
    92    discussion only and may change at any moment. Its publication here does
    93    not imply endorsement of its contents by W3C. Don't cite this document
    94    other than as work in progress.
    96   <p>The (<a
    97    href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
    98    mailing list <a
    99    href="mailto:www-style@w3.org?Subject=%5Bcss3-values%5D%20PUT%20SUBJECT%20HERE">
   100    www-style@w3.org</a> (see <a
   101    href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
   102    discussion of this specification. When sending e-mail, please put the text
   103    &#8220;css3-values&#8221; in the subject, preferably like this:
   104    &#8220;[<!---->css3-values<!---->] <em>&hellip;summary of
   105    comment&hellip;</em>&#8221;
   107   <p>This document was produced by the <a href="/Style/CSS/members">CSS
   108    Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
   110   <p>This document was produced by a group operating under the <a
   111    href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
   112    Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
   113    rel=disclosure>public list of any patent disclosures</a> made in
   114    connection with the deliverables of the group; that page also includes
   115    instructions for disclosing a patent. An individual who has actual
   116    knowledge of a patent which the individual believes contains <a
   117    href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
   118    Claim(s)</a> must disclose the information in accordance with <a
   119    href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
   120    W3C Patent Policy</a>.</p>
   121   <!--end-status-->
   123   <p>All features described in this specification that also exist in CSS 2.1
   124    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> are intended
   125    to be backwards compatible. In case of conflict between this draft and
   126    CSS&nbsp;2.1 <a href="#CSS21"
   127    rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, CSS&nbsp;2.1 probably
   128    represents the intention of the CSS WG better than this draft (other than
   129    on values and units that are new to CSS3).
   131   <p>This is a draft of a <a href="http://www.w3.org/TR/css3-roadmap/">module
   132    of CSS level 3</a>. It will probably be bundled with some other modules
   133    before it becomes a <a href="http://www.w3.org/TR/#About">W3C
   134    Recommendation</a>.
   136   <h2 class="no-num no-toc" id=contents>Table of contents</h2>
   137   <!--begin-toc-->
   139   <ul class=toc>
   140    <li><a href="#introduction"><span class=secno>1. </span>Introduction</a>
   141     <ul class=toc>
   142      <li><a href="#placement"><span class=secno>1.1. </span> Module
   143       Interactions</a>
   144     </ul>
   146    <li><a href="#value-defs"><span class=secno>2. </span> Value Definition
   147     Syntax</a>
   148     <ul class=toc>
   149      <li><a href="#component-types"><span class=secno>2.1. </span> Component
   150       value types</a>
   152      <li><a href="#component-combinators"><span class=secno>2.2. </span>
   153       Component value combinators</a>
   155      <li><a href="#component-multipliers"><span class=secno>2.3. </span>
   156       Component value multipliers</a>
   158      <li><a href="#component-whitespace"><span class=secno>2.4. </span>
   159       Component values and white space</a>
   161      <li><a href="#value-examples"><span class=secno>2.5. </span> Property
   162       value examples</a>
   163     </ul>
   165    <li><a href="#syntax-and-terminology"><span class=secno>3. </span>Syntax
   166     and terminology</a>
   167     <ul class=toc>
   168      <li><a href="#strings"><span class=secno>3.1. </span>Strings</a>
   170      <li><a href="#functional-notation"><span class=secno>3.2.
   171       </span>Functional notation</a>
   172     </ul>
   174    <li><a href="#idents"><span class=secno>4. </span> Keywords and
   175     Identifiers</a>
   176     <ul class=toc>
   177      <li><a href="#keywords"><span class=secno>4.1. </span> Pre-defined
   178       Keywords</a>
   179       <ul class=toc>
   180        <li><a href="#initial-inherit"><span class=secno>4.1.1. </span> The
   181         &lsquo;<code class=css>initial</code>&rsquo; and &lsquo;<code
   182         class=css>inherit</code>&rsquo; keywords</a>
   183       </ul>
   185      <li><a href="#identifiers"><span class=secno>4.2. </span> User-defined
   186       Identifiers: the &lsquo;<code
   187       class=css>&lt;identifier&gt;</code>&rsquo; type</a>
   188     </ul>
   190    <li><a href="#numeric-types"><span class=secno>5. </span> Numeric Data
   191     Types</a>
   192     <ul class=toc>
   193      <li><a href="#integers"><span class=secno>5.1. </span> Integers: the
   194       &lsquo;<code class=css>&lt;integer&gt;</code>&rsquo; type</a>
   196      <li><a href="#numbers"><span class=secno>5.2. </span> Numbers: the
   197       &lsquo;<code class=css>&lt;number&gt;</code>&rsquo; type</a>
   199      <li><a href="#percentages"><span class=secno>5.3. </span> Percentages:
   200       the &lsquo;<code class=css>&lt;percentage&gt;</code>&rsquo; type</a>
   201     </ul>
   203    <li><a href="#lengths"><span class=secno>6. </span> Distance Units: the
   204     &lsquo;<code class=css>&lt;length&gt;</code>&rsquo; type</a>
   205     <ul class=toc>
   206      <li><a href="#relative-lengths"><span class=secno>6.1. </span> Relative
   207       lengths</a>
   208       <ul class=toc>
   209        <li><a href="#font-relative-lengths"><span class=secno>6.1.1. </span>
   210         Font-relative lengths: the &lsquo;<code class=css>em</code>&rsquo;,
   211         &lsquo;<code class=css>ex</code>&rsquo;, &lsquo;<code
   212         class=css>ch</code>&rsquo;, &lsquo;<code class=css>rem</code>&rsquo;
   213         units</a>
   215        <li><a href="#viewport-relative-lengths"><span class=secno>6.1.2.
   216         </span> Viewport-relative lengths: the &lsquo;<code
   217         class=css>vw</code>&rsquo;, &lsquo;<code class=css>vh</code>&rsquo;,
   218         &lsquo;<code class=css>vm</code>&rsquo; units</a>
   219       </ul>
   221      <li><a href="#absolute-lengths"><span class=secno>6.2. </span> Absolute
   222       lengths: the &lsquo;<code class=css>cm</code>&rsquo;, &lsquo;<code
   223       class=css>mm</code>&rsquo;, &lsquo;<code class=css>in</code>&rsquo;,
   224       &lsquo;<code class=css>pt</code>&rsquo;, &lsquo;<code
   225       class=css>pc</code>&rsquo;, &lsquo;<code class=css>px</code>&rsquo;
   226       units </a>
   227     </ul>
   229    <li><a href="#other-units"><span class=secno>7. </span> Other Units</a>
   230     <ul class=toc>
   231      <li><a href="#angles"><span class=secno>7.1. </span> Angles: the
   232       &lsquo;<code class=css>&lt;angle&gt;</code>&rsquo; type and
   233       &lsquo;<code class=css>deg</code>&rsquo;, &lsquo;<code
   234       class=css>grad</code>&rsquo;, &lsquo;<code class=css>rad</code>&rsquo;,
   235       &lsquo;<code class=css>turn</code>&rsquo; units</a>
   237      <li><a href="#time"><span class=secno>7.2. </span> Times: the
   238       &lsquo;<code class=css>&lt;time&gt;</code>&rsquo; type and &lsquo;<code
   239       class=css>s</code>&rsquo;, &lsquo;<code class=css>ms</code>&rsquo;
   240       units</a>
   242      <li><a href="#frequencies-the-ltfrequencygt-type-and-h"><span
   243       class=secno>7.3. </span>Frequencies: the &lsquo;<code
   244       class=css>&lt;frequency&gt;</code>&rsquo; type and &lsquo;<code
   245       class=css>Hz</code>&rsquo;, &lsquo;<code class=css>kHz</code>&rsquo;
   246       units</a>
   247       <ul class=toc>
   248        <li><a href="#the-calc-min-and-max-functions"><span class=secno>7.3.1.
   249         </span>The &lsquo;<code class=property>calc</code>&rsquo;,
   250         &lsquo;<code class=property>min</code>&rsquo; and &lsquo;<code
   251         class=property>max</code>&rsquo; functions</a>
   252       </ul>
   254      <li><a href="#ltstringgt"><span class=secno>7.4.
   255       </span>&lt;string&gt;</a>
   257      <li><a href="#ltcolorgt"><span class=secno>7.5. </span>&lt;color&gt;</a>
   260      <li><a href="#ltattrgt"><span class=secno>7.6. </span>&lt;attr&gt;</a>
   262      <li><a href="#uris"><span class=secno>7.7. </span>&lt;url&gt;</a>
   264      <li><a href="#ltimagegt"><span class=secno>7.8. </span>&lt;image&gt;</a>
   267      <li><a href="#ltfractiongt"><span class=secno>7.9.
   268       </span>&lt;fraction&gt;</a>
   269       <ul class=toc>
   270        <li><a href="#the-fr-unit"><span class=secno>7.9.1. </span>The
   271         &lsquo;<code class=property>fr</code>&rsquo; unit</a>
   272       </ul>
   274      <li><a href="#ltgridgt"><span class=secno>7.10. </span>&lt;grid&gt;</a>
   275       <ul class=toc>
   276        <li><a href="#the-gr-unit"><span class=secno>7.10.1. </span>The
   277         &lsquo;<code class=property>gr</code>&rsquo; unit</a>
   278       </ul>
   279     </ul>
   281    <li><a href="#specified-computed-used-and-actual-value"><span
   282     class=secno>8. </span>Specified, computed, used, and actual values</a>
   283     <ul class=toc>
   284      <li><a href="#finding-the-specified-value"><span class=secno>8.1.
   285       </span>Finding the specified value</a>
   287      <li><a href="#finding-the-computed-value"><span class=secno>8.2.
   288       </span>Finding the computed value</a>
   290      <li><a href="#finding-the-used-value"><span class=secno>8.3.
   291       </span>Finding the used value</a>
   293      <li><a href="#finding-the-actual-value"><span class=secno>8.4.
   294       </span>Finding the actual value</a>
   295     </ul>
   297    <li class=no-num><a href="#acknowledgments">Acknowledgments</a>
   299    <li class=no-num><a href="#references">References</a>
   300     <ul class=toc>
   301      <li class=no-num><a href="#normative-references">Normative
   302       references</a>
   304      <li class=no-num><a href="#other-references">Other references</a>
   305     </ul>
   307    <li class=no-num><a href="#index">Index</a>
   308   </ul>
   309   <!--end-toc-->
   311   <h2 id=introduction><span class=secno>1. </span>Introduction</h2>
   313   <p>The value definition field of each CSS property can contain keywords,
   314    data types (which appear between &lsquo;<code class=css><</code>&rsquo;
   315    and &lsquo;<code class=css>></code>&rsquo;), and information on how they
   316    can be combined. Generic data types (<a
   317    href="#length-value"><code>&lt;length&gt;</code></a> being the most widely
   318    used) that can be used by many properties are described in this
   319    specification, while more specific data types (e.g.,
   320    <code>&lt;border-width&gt;</code>) are described in the corresponding
   321    modules. </code>
   323   <h3 id=placement><span class=secno>1.1. </span> Module Interactions</h3>
   325   <p>This module replaces and extends the data type definitions in <a
   326    href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> sections <a
   327    href="http://www.w3.org/TR/CSS21/about.html#value-defs">1.4.2.1</a>, <a
   328    href="http://www.w3.org/TR/CSS21/syndata.html#values">4.3</a>, and <a
   329    href="http://www.w3.org/TR/CSS21/aural.html#aural-intro">A.2</a>.
   331   <h2 id=value-defs><span class=secno>2. </span> Value Definition Syntax</h2>
   333   <p>The syntax described here is used to define the set of valid values for
   334    CSS properties. A property value can have one or more components.
   336   <h3 id=component-types><span class=secno>2.1. </span> Component value types</h3>
   338   <p>Component value types are designated in several ways:
   340   <ol>
   341    <li><a href="#keyword">keyword</a> values (such as &lsquo;<code
   342     class=css>auto</code>&rsquo;, &lsquo;<code class=css>disc</code>&rsquo;,
   343     etc.), which appear literally, without quotes (e.g. <code>auto</code>)
   345    <li>basic data types, which appear between &lsquo;<code
   346     class=css>&lt;</code>&rsquo; and &lsquo;<code
   347     class=css>&gt;</code>&rsquo; (e.g., <a
   348     href="#length-value"><code>&lt;length&gt;</code></a>, <a
   349     href="#percentage-value"><code>&lt;percentage&gt;</code></a>, etc.).
   351    <li>types that have the same range of values as a property bearing the
   352     same name (e.g., <code>&lt;'border-width'&gt;</code>
   353     <code>&lt;'background-attachment'&gt;</code>, etc.). In this case, the
   354     type name is the property name (complete with quotes) between the
   355     brackets. Such a type does <em>not</em> include the value &lsquo;<code
   356     class=property>inherit</code>&rsquo;.
   358    <li>non-terminals that do not share the same name as a property. In this
   359     case, the non-terminal name appears between &lsquo;<code
   360     class=css>&lt;</code>&rsquo; and &lsquo;<code
   361     class=css>&gt;</code>&rsquo;, as in <code>&lt;spacing&gt;</code>. Notice
   362     the distinction between <code>&lt;border-width&gt;</code> and
   363     <code>&lt;'border-width'&gt;</code>: the latter is defined as the value
   364     of the &lsquo;<code class=property>border-width</code>&rsquo; property,
   365     the former requires an explicit expansion elsewhere. The definition of a
   366     non-terminal is located near its first appearance in the specification.
   367   </ol>
   369   <p>Some property value definitions also include the slash (/) and/or the
   370    comma (,) as literals. These represent their corresponding tokens.
   372   <p>All CSS properties also accept the keyword values &lsquo;<code
   373    class=css>inherit</code>&rsquo; and &lsquo;<code
   374    class=css>initial</code>&rsquo; as their property value, but for
   375    readability these are not listed explicitly in the property value syntax
   376    definitions. These keywords cannot be combined with other component values
   377    in same declaration; such a declaration is invalid. For example,
   378    &lsquo;<code class=css>background: url(corner.png) no-repeat,
   379    inherit;</code>&rsquo; is invalid.
   381   <h3 id=component-combinators><span class=secno>2.2. </span> Component value
   382    combinators</h3>
   384   <p>Component values can be arranged into property values as follows:
   386   <ul>
   387    <li>Several juxtaposed words mean that all of them must occur, in the
   388     given order.
   390    <li>A double ampersand (&&) separates two or more components, all of which
   391     must occur, in any order.
   393    <li>A double bar (||) separates two or more options: one or more of them
   394     must occur, in any order.
   396    <li>A bar (|) separates two or more alternatives: exactly one of them must
   397     occur.
   399    <li>Brackets ([&nbsp;]) are for grouping.
   400   </ul>
   402   <p>Juxtaposition is stronger than the double ampersand, the double
   403    ampersand is stronger than the double bar, and the double bar is stronger
   404    than the bar. Thus, the following lines are equivalent:
   406   <pre>
   407 <!---->  a b   |   c ||   d &&   e f
   408 <!---->[ a b ] | [ c || [ d && [ e f ]]]</pre>
   410   <h3 id=component-multipliers><span class=secno>2.3. </span> Component value
   411    multipliers</h3>
   413   <p>Every type, keyword, or bracketed group may be followed by one of the
   414    following modifiers:
   416   <ul>
   417    <li>An asterisk (*) indicates that the preceding type, word, or group
   418     occurs zero or more times.
   420    <li>A plus (+) indicates that the preceding type, word, or group occurs
   421     one or more times.
   423    <li>A question mark (?) indicates that the preceding type, word, or group
   424     is optional.
   426    <li>A pair of numbers in curly braces ({<var>A</var>,<var>B</var>})
   427     indicates that the preceding type, word, or group occurs at least
   428     <var>A</var> and at most <var>B</var> times.
   430    <li>A hash mark (#) indicates that the preceding type, word, or group
   431     occurs one or more times, separated by comma tokens.
   432   </ul>
   434   <h3 id=component-whitespace><span class=secno>2.4. </span> Component values
   435    and white space</h3>
   437   <p>Component values are specified in terms of tokens, as described in <a
   438    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">Chapter 4</a>
   439    of <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. As the
   440    grammar allows spaces between tokens in the components of the
   441    <code>value</code> production, spaces may appear between tokens in
   442    property values.
   444   <p class=note>Note: In many cases, spaces will in fact be <em>required</em>
   445    between tokens in order to distinguish them from each other. For example,
   446    the value &lsquo;<code class=css>1em2em</code>&rsquo; would be parsed as a
   447    single <code>DIMEN</code> token with the number &lsquo;<code
   448    class=css>1</code>&rsquo; and the identifier &lsquo;<code
   449    class=css>em2em</code>&rsquo;, which is an invalid unit. In this case, a
   450    space would be required before the &lsquo;<code class=css>2</code>&rsquo;
   451    to get this parsed as the two lengths &lsquo;<code
   452    class=css>1em</code>&rsquo; and &lsquo;<code class=css>2em</code>&rsquo;.
   454   <h3 id=value-examples><span class=secno>2.5. </span> Property value
   455    examples</h3>
   457   <p>Below are some examples of properties with their corresponding value
   458    definition fields
   460   <div class=example>
   461    <table class=data id=propvalues>
   462     <thead>
   463      <tr>
   464       <th>Property
   466       <th>Value definition field
   468       <th>Example value
   470     <tbody>
   471      <tr>
   472       <td>&lsquo;<code class=property>orphans</code>&rsquo;
   474       <td>&lt;integer&gt;
   476       <td>&lsquo;<code class=css>3</code>&rsquo;
   478      <tr>
   479       <td>&lsquo;<code class=property>text-align</code>&rsquo;
   481       <td>left | right | center | justify
   483       <td>&lsquo;<code class=css>center</code>&rsquo;
   485      <tr>
   486       <td>&lsquo;<code class=property>padding-top</code>&rsquo;
   488       <td>&lt;length&gt; | &lt;percentage&gt;
   490       <td>&lsquo;<code class=css>5%</code>&rsquo;
   492      <tr>
   493       <td>&lsquo;<code class=property>outline-color</code>&rsquo;
   495       <td>&lt;color&gt; | invert
   497       <td>&lsquo;<code class=css>#fefefe</code>&rsquo;
   499      <tr>
   500       <td>&lsquo;<code class=property>text-decoration</code>&rsquo;
   502       <td>none | underline || overline || line-through || blink
   504       <td>&lsquo;<code class=css>overline underline</code>&rsquo;
   506      <tr>
   507       <td>&lsquo;<code class=property>font-family</code>&rsquo;
   509       <td>&lt;family-name&gt;#
   511       <td>&lsquo;<code class=css>"Gill Sans", Futura,
   512        sans-serif</code>&rsquo;
   514      <tr>
   515       <td>&lsquo;<code class=property>border-width</code>&rsquo;
   517       <td>[ &lt;length&gt; | thick | medium | thin ]{1,4}
   519       <td>&lsquo;<code class=css>2px medium 4px</code>&rsquo;
   521      <tr>
   522       <td>&lsquo;<code class=property>text-shadow</code>&rsquo;
   524       <td>[ inset? && [ &lt;length&gt;{2,4} && &lt;color&gt;? ] ]# | none
   526       <td>&lsquo;<code class=css>3px 3px rgba(50%, 50%, 50%, 50%),
   527        lemonchiffon 0 0 4px inset</code>&rsquo;
   529      <tr>
   530       <td>&lsquo;<code class=property>voice-pitch</code>&rsquo;
   532       <td>
   533        <pre class=value>&lt;frequency> && absolute |
   534 <!--				      -->[[x-low | low | medium | high | x-high] ||
   535 <!--				      --> [&lt;frequency> | &lt;semitones> | &lt;percentage>]]</pre>
   537       <td>&lsquo;<code class=css>-2st x-low</code>&rsquo;
   538    </table>
   539   </div>
   541   <h2 id=syntax-and-terminology><span class=secno>3. </span>Syntax and
   542    terminology</h2>
   544   <p>The generic data types described in the next sections use some common
   545    syntactic building blocks and terms that are described in this section.
   547   <h3 id=strings><span class=secno>3.1. </span>Strings</h3>
   549   <p>A <dfn id=string>string</dfn> is a sequence of characters enclosed by
   550    double quotes or single quotes. Double quotes cannot occur inside double
   551    quotes, unless escaped (as &lsquo;<code class=css>\"</code>&rsquo; or as
   552    &lsquo;<code class=css>\22</code>&rsquo;). Analogously for single quotes
   553    ("\&lsquo;<code class=css>" or "\27").<!--"--> </code>
   555   <div class=example>
   556    <pre>
   557 content: "this is a &rsquo;string'.";
   558 content: "this is a \"string\".";
   559 content: &lsquo;<code class=css>this is a "string".</code>&rsquo;;
   560 content: &lsquo;<code class=css>this is a \</code>&rsquo;string\&lsquo;<code class=css>.</code>&rsquo;;
   561 </pre>
   562   </div>
   564   <p>A string cannot directly contain a <span class=index
   565    id=newline>newline</span>. To include a newline in a string, use the
   566    escape "\A" (hexadecimal A is the line feed character in Unicode (U+000A),
   567    but represents the generic notion of "newline" in CSS). See the <span
   568    class=property>&lsquo;<code class=property>content</code>&rsquo;</span>
   569    property for an example.
   571   <p>It is possible to break strings over several lines, for aesthetic or
   572    other reasons, but in such a case the newline itself has to be escaped
   573    with a backslash (\). The newline is subsequently removed from the string.
   574    For instance, the following two selectors are exactly the same:
   576   <div class=example>
   577    <p style="display:none">Example(s):</p>
   579    <pre>
   580 a[title="a not s\
   581 o very long title"] {/*...*/}
   582 a[title="a not so very long title"] {/*...*/}
   583 </pre>
   584   </div>
   586   <h3 id=functional-notation><span class=secno>3.2. </span>Functional
   587    notation</h3>
   589   <p>Some values use a <dfn id=functional-notation0>functional notation</dfn>
   590    to type values and to and lump values together. The syntax starts with the
   591    name of the function followed by a left parenthesis followed by optional
   592    whitespace followed by the argument(s) to the functions followed by
   593    optional whitespace followed by a right parenthesis. If a function takes
   594    more than one argument, the arguments are separated by a comma
   595    (&lsquo;<code class=css>,</code>&rsquo;) with optional whitespace before
   596    and after the comma.
   598   <div class=example> background: url(http://www.example.org/image); color:
   599    rgb(100, 200, 50 );</div>
   601   <p>Some properties accept space- or comma-separated lists of values. A
   602    value that is composed of several values with spaces or commas between
   603    them, is called a <dfn id=compound-value>compound value</dfn>. A value
   604    that is not a compound value is a <dfn id=simple-value>simple value</dfn>.
   607   <h2 id=idents><span class=secno>4. </span> Keywords and Identifiers</h2>
   609   <p>An <dfn id=identifier>identifier</dfn> is a sequence of characters
   610    conforming to the <code>IDENT</code> token in the <a
   611    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   612    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Identifiers
   613    cannot be quoted; otherwise they would be interpreted as a string.
   615   <h3 id=keywords><span class=secno>4.1. </span> Pre-defined Keywords</h3>
   617   <p>In the value definition fields, keywords with a pre-defined meaning
   618    appear literally. Keywords are CSS <i>identifiers</i> and are interpreted
   619    case-insensitively within the ASCII range (i.e., [a-z] and [A-Z] are
   620    equivalent).
   622   <div class=example>
   623    <p>For example, here is the value definition for the &lsquo;<code
   624     class=property>border-collapse</code>&rsquo; property:</p>
   626    <pre>Value:&nbsp;collapse | separate</pre>
   628    <p>And here is an example of its use:</p>
   630    <pre>table { border-collapse: separate }</pre>
   631   </div>
   633   <h4 id=initial-inherit><span class=secno>4.1.1. </span> The &lsquo;<code
   634    class=css>initial</code>&rsquo; and &lsquo;<code
   635    class=css>inherit</code>&rsquo; keywords</h4>
   637   <p>As defined <a href="#component-types">above</a>, all properties accept
   638    the &lsquo;<code class=css>initial</code>&rsquo; and &lsquo;<code
   639    class=css>inherit</code>&rsquo; keywords, which represent value concepts
   640    common to all CSS properties.
   642   <p>The <dfn id=inherit>&lsquo;<code class=css>inherit</code>&rsquo;</dfn>
   643    keyword is <a
   644    href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">defined</a>
   645    in <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
   647   <p>The <dfn id=initial>&lsquo;<code class=css>initial</code>&rsquo;</dfn>
   648    keyword represents the value that is designated as the property's initial
   649    value. <a href="#CSS3CASCADE"
   650    rel=biblioentry>[CSS3CASCADE]<!--{{CSS3CASCADE}}--></a>
   652   <p class=issue>Should these keywords affect the specified or computed
   653    value? See <a
   654    href="http://lists.w3.org/Archives/Public/www-style/2011Jan/0075.html">various</a>
   655    <a
   656    href="http://lists.w3.org/Archives/Public/www-style/2011May/0402.html">issues</a>.
   659   <p class=issue>Would it be useful to have a &lsquo;<code
   660    class=property>default</code>&rsquo; value, defined to be equivalent to <a
   661    class=css href="#inherit">&lsquo;<code
   662    class=property>inherit</code>&rsquo;</a> for properties that are inherited
   663    by default and equivalent to <a class=css href="#initial">&lsquo;<code
   664    class=property>initial</code>&rsquo;</a> for properties that are not
   665    inherited by default? This might be easier for authors to use than <a
   666    class=css href="#initial">&lsquo;<code
   667    class=property>initial</code>&rsquo;</a> and <a class=css
   668    href="#inherit">&lsquo;<code class=property>inherit</code>&rsquo;</a>
   669    since it wouldn't require thinking about whether a property is inherited
   670    by default or not (which isn't obvious for some properties, such as
   671    text-decoration and visibility).
   673   <h3 id=identifiers><span class=secno>4.2. </span> User-defined Identifiers:
   674    the &lsquo;<a href="#identifier-value"><code
   675    class=css>&lt;identifier&gt;</code></a>&rsquo; type</h3>
   677   <p>Some properties accept arbitrary user-defined identifiers as a component
   678    value. This generic data type is denoted by <dfn
   679    id=identifier-value><code>&lt;identifier&gt;</code></dfn>, and represents
   680    any valid CSS <a href="#identifier"><i>identifier</i></a> that does not
   681    otherwise appear as a pre-defined keyword in that property's value
   682    definition. Such identifiers are fully case-sensitive, even in the ASCII
   683    range (e.g. &lsquo;<code class=css>example</code>&rsquo; and &lsquo;<code
   684    class=css>EXAMPLE</code>&rsquo; are two different, unrelated user-defined
   685    identifiers).
   687   <h2 id=numeric-types><span class=secno>5. </span> Numeric Data Types</h2>
   689   <h3 id=integers><span class=secno>5.1. </span> Integers: the &lsquo;<a
   690    href="#integer-value"><code class=css>&lt;integer&gt;</code></a>&rsquo;
   691    type</h3>
   693   <p>Integer values are denoted by <dfn
   694    id=integer-value><code>&lt;integer&gt;</code></dfn>. An <dfn
   695    id=integer>integer</dfn> is one or more decimal digits &lsquo;<code
   696    class=css>0</code>&rsquo; through &lsquo;<code class=css>9</code>&rsquo;
   697    and corresponds to a subset of the <a
   698    href="#number"><code>NUMBER</code></a> token in the <a
   699    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   700    Integers may be immediately preceded by &lsquo;<code
   701    class=css>-</code>&rsquo; or &lsquo;<code class=css>+</code>&rsquo; to
   702    indicate the sign.
   704   <p>Properties may restrict the integer value to some range. If the value is
   705    outside the allowed range, the declaration is invalid and must be <a
   706    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   708   <h3 id=numbers><span class=secno>5.2. </span> Numbers: the &lsquo;<a
   709    href="#number-value"><code class=css>&lt;number&gt;</code></a>&rsquo; type</h3>
   711   <p>Number values are denoted by <dfn
   712    id=number-value><code>&lt;number&gt;</code></dfn>. A <dfn
   713    id=number>number</dfn> is either an <a href="#integer"><i>integer</i></a>,
   714    or zero or more decimal digits followed by a dot (.) followed by one or
   715    more decimal digits. It corresponds to the <a
   716    href="#number"><code>NUMBER</code></a> token in the <a
   717    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   718    Like integers, numbers may also be immediately preceded by &lsquo;<code
   719    class=css>-</code>&rsquo; or &lsquo;<code class=css>+</code>&rsquo; to
   720    indicate the sign.
   722   <p>Properties may restrict the number value to some range. If the value is
   723    outside the allowed range, the declaration is invalid and must be <a
   724    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   726   <h3 id=percentages><span class=secno>5.3. </span> Percentages: the
   727    &lsquo;<a href="#percentage-value"><code
   728    class=css>&lt;percentage&gt;</code></a>&rsquo; type</h3>
   730   <p>A percentage value is denoted by <dfn
   731    id=percentage-value><code>&lt;percentage&gt;</code></dfn>, consists of a
   732    <a href="#number-value"><i>&lt;number&gt;</i></a> immediately followed by
   733    a percent sign &lsquo;<code class=css>%</code>&rsquo;. It corresponds to
   734    the <code>PERCENTAGE</code> token in the <a
   735    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   737   <p>Percentage values are always relative to another value, for example a
   738    length. Each property that allows percentages also defines the value to
   739    which the percentage refers. The value may be that of another property for
   740    the same element, a property for an ancestor element, or a value of the
   741    formatting context (e.g., the width of a <i>containing block</i>). When a
   742    percentage value is set for a property of the <i>root</i> element and the
   743    percentage is defined as referring to the inherited value of some
   744    property, the resultant value is the percentage times the <i>initial
   745    value</i> of that property.
   747   <p>Properties may restrict the percentage value to some range. If the value
   748    is outside the allowed range, the declaration is invalid and must be <a
   749    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   751   <h2 id=lengths><span class=secno>6. </span> Distance Units: the &lsquo;<a
   752    href="#length-value"><code class=css>&lt;length&gt;</code></a>&rsquo; type</h2>
   754   <p>Lengths refer to distance measurements and are denoted by <dfn
   755    id=length-value><code>&lt;length&gt;</code></dfn> in the property
   756    definitions. A length is a <a href="#dimension"><i>dimension</i></a>. A
   757    zero length may be represented instead as the <a
   758    href="#number-value"><code>&lt;number&gt;</code></a> &lsquo;<code
   759    class=css>0</code>&rsquo;. (In other words, for zero lengths the unit
   760    identifier is optional.)
   762   <p> A <dfn id=dimension>dimension</dfn> is a <a
   763    href="#number"><i>number</i></a> immediately followed by a unit
   764    identifier. It corresponds to the <a
   765    href="#dimension"><code>DIMENSION</code></a> token in the <a
   766    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   767    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Like
   768    keywords, unit identifiers are case-insensitive within the ASCII range.
   770   <p>Properties may restrict the length value to some range. If the value is
   771    outside the allowed range, the declaration is invalid and must be <a
   772    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   774   <p>While some properties allow negative length values, this may complicate
   775    the formatting and there may be implementation-specific limits. If a
   776    negative length value is allowed but cannot be supported, it must be
   777    converted to the nearest value that can be supported.
   779   <p>In cases where the <a href="#used-value">used</a> length cannot be
   780    supported, user agents must approximate it in the <a
   781    href="#actual-value">actual</a> value.
   783   <p>There are two types of length units: relative and absolute.
   785   <h3 id=relative-lengths><span class=secno>6.1. </span> Relative lengths</h3>
   787   <p><dfn id=relative-length-units title="relative length">Relative length
   788    units</dfn> specify a length relative to another length. Style sheets that
   789    use relative units can more easily scale from one output environment to
   790    another.
   792   <p>The relative units are:
   794   <table class=data>
   795    <caption>Informative Summary of Relative Units</caption>
   797    <thead>
   798     <tr>
   799      <th>unit
   801      <th>relative to
   803    <tbody>
   804     <tr>
   805      <td>&lsquo;<a href="#em-unit"><code class=css>em</code></a>&rsquo;
   807      <td>font size of the element
   809     <tr>
   810      <td>&lsquo;<a href="#ex-unit"><code class=css>ex</code></a>&rsquo;
   812      <td><i>x-height</i> of the element's font
   814     <tr>
   815      <td>&lsquo;<a href="#ch-unit"><code class=css>ch</code></a>&rsquo;
   817      <td>width of the "0" glyph in the element's font
   819     <tr>
   820      <td>&lsquo;<a href="#rem-unit"><code class=css>rem</code></a>&rsquo;
   822      <td>font size of the root element
   824     <tr>
   825      <td>&lsquo;<a href="#vw-unit"><code class=css>vw</code></a>&rsquo;
   827      <td>viewport's width
   829     <tr>
   830      <td>&lsquo;<a href="#vh-unit"><code class=css>vh</code></a>&rsquo;
   832      <td>viewport's height
   834     <tr>
   835      <td>&lsquo;<a href="#vm-unit"><code class=css>vm</code></a>&rsquo;
   837      <td>minimum of the viewport's height and width
   838   </table>
   840   <p>Child elements do not inherit the relative values as specified for their
   841    parent; they inherit the <a href="#computed-value">computed values</a>.
   843   <h4 id=font-relative-lengths><span class=secno>6.1.1. </span> Font-relative
   844    lengths: the &lsquo;<a href="#em-unit"><code
   845    class=css>em</code></a>&rsquo;, &lsquo;<a href="#ex-unit"><code
   846    class=css>ex</code></a>&rsquo;, &lsquo;<a href="#ch-unit"><code
   847    class=css>ch</code></a>&rsquo;, &lsquo;<a href="#rem-unit"><code
   848    class=css>rem</code></a>&rsquo; units</h4>
   850   <p>Aside from &lsquo;<a href="#rem-unit"><code
   851    class=css>rem</code></a>&rsquo; (which refers to the font-size of the root
   852    element), the font-relative lengths refer to the computed font metrics of
   853    the element on which they are used. The exception is when they occur in
   854    the value of the &lsquo;<code class=property>font-size</code>&rsquo;
   855    property itself, in which case they refer to the font metrics of the
   856    parent element (or the font metrics corresponding to the initial values of
   857    the &lsquo;<code class=property>font</code>&rsquo; property, if the
   858    element has no parent).
   860   <dl>
   861    <dt><dfn id=em-unit title=em>em unit</dfn>
   863    <dd>
   864     <p>Equal to the computed value of the &lsquo;<code
   865      class=property>font-size</code>&rsquo; property of the element on which
   866      it is used.
   868     <div class=example>
   869      <p>The rule:</p>
   871      <pre>h1 { line-height: 1.2em }</pre>
   873      <p>means that the line height of <code>h1</code> elements will be 20%
   874       greater than the font size of <code>h1</code> element. On the other
   875       hand:
   877      <pre>h1 { font-size: 1.2em }</pre>
   879      <p>means that the font size of <code>h1</code> elements will be 20%
   880       greater than the font size inherited by <code>h1</code> elements.</p>
   881     </div>
   883    <dt><dfn id=ex-unit title=ex>ex unit</dfn>
   885    <dd>
   886     <p>Equal to the font's x-height. The x-height is so called because it is
   887      often equal to the height of the lowercase "x". However, an &lsquo;<a
   888      href="#ex-unit"><code class=css>ex</code></a>&rsquo; is defined even for
   889      fonts that do not contain an "x".
   891     <p>The x-height of a font can be found in different ways. Some fonts
   892      contain reliable metrics for the x-height. If reliable font metrics are
   893      not available, UAs may determine the x-height from the height of a
   894      lowercase glyph. One possible heuristic is to look at how far the glyph
   895      for the lowercase "o" extends below the baseline, and subtract that
   896      value from the top of its bounding box. In the cases where it is
   897      impossible or impractical to determine the x-height, a value of 0.5em
   898      must be assumed.
   900    <dt><dfn id=ch-unit title=ch>ch unit</dfn>
   902    <dd>
   903     <p>Equal to the advance measure of the "0" (ZERO, U+0030) glyph found in
   904      the font used to render it.
   906    <dt><dfn id=rem-unit title=rem>rem unit</dfn>
   908    <dd>
   909     <p>Equal to the computed value of &lsquo;<code
   910      class=property>font-size</code>&rsquo; on the root element.
   912     <p>When specified on the &lsquo;<code
   913      class=property>font-size</code>&rsquo; property of the root element, the
   914      &lsquo;<a href="#rem-unit"><code class=css>rem</code></a>&rsquo; units
   915      refer to the property's <em>initial value</em>.</p>
   916   </dl>
   918   <h4 id=viewport-relative-lengths><span class=secno>6.1.2. </span>
   919    Viewport-relative lengths: the &lsquo;<a href="#vw-unit"><code
   920    class=css>vw</code></a>&rsquo;, &lsquo;<a href="#vh-unit"><code
   921    class=css>vh</code></a>&rsquo;, &lsquo;<a href="#vm-unit"><code
   922    class=css>vm</code></a>&rsquo; units</h4>
   924   <p>The viewport-relative lengths are relative to the size of the initial
   925    containing block. When the height or width of the viewport is changed,
   926    they are scaled proportionally.
   928   <dl>
   929    <dt><dfn id=vw-unit title=vw>vw unit</dfn>
   931    <dd>Equal to 1/100th of the width of the initial containing block.
   932     <div class=example>
   933      <p>In the example below, if the width of the viewport is 200mm, the font
   934       size of <code>h1</code> elements will be 16mm (i.e.
   935       (8&times;200mm)/100).
   937      <pre>h1 { font-size: 8vw }</pre>
   938     </div>
   940    <dt><dfn id=vh-unit title=vh>vh unit</dfn>
   942    <dd>Equal to 1/100th of the height of the initial containing block.
   944    <dt><dfn id=vm-unit title=vm>vm unit</dfn>
   946    <dd>Equal to the smaller of &lsquo;<a href="#vw-unit"><code
   947     class=css>vw</code></a>&rsquo; or &lsquo;<a href="#vh-unit"><code
   948     class=css>vh</code></a>&rsquo;.
   949     <p class=issue>Do we need this now that we have the min() function?
   950   </dl>
   952   <h3 id=absolute-lengths><span class=secno>6.2. </span> Absolute lengths:
   953    the &lsquo;<code class=css>cm</code>&rsquo;, &lsquo;<code
   954    class=css>mm</code>&rsquo;, &lsquo;<code class=css>in</code>&rsquo;,
   955    &lsquo;<code class=css>pt</code>&rsquo;, &lsquo;<code
   956    class=css>pc</code>&rsquo;, &lsquo;<code class=css>px</code>&rsquo; units</h3>
   958   <p>The <dfn id=absolute-length-units>absolute length units</dfn> are fixed
   959    in relation to each other and anchored to some physical measurement. They
   960    are mainly useful when the output environment is known. The absolute units
   961    consist of the physical units (in, cm, mm, pt, pc) and the px unit:
   963   <table class=data>
   964    <thead>
   965     <tr>
   966      <th>unit
   968      <th>definition
   970    <tbody>
   971     <tr>
   972      <td>&lsquo;<code class=css>cm</code>&rsquo;
   974      <td>centimeters
   976     <tr>
   977      <td>&lsquo;<code class=css>mm</code>&rsquo;
   979      <td>millimeters
   981     <tr>
   982      <td>&lsquo;<code class=css>in</code>&rsquo;
   984      <td>inches; 1in is equal to 2.54cm
   986     <tr>
   987      <td>&lsquo;<code class=css>px</code>&rsquo;
   989      <td>pixels; 1px is equal to 1/96th of 1in
   991     <tr>
   992      <td>&lsquo;<code class=css>pt</code>&rsquo;
   994      <td>points; 1pt is equal to 1/72nd of 1in
   996     <tr>
   997      <td>&lsquo;<code class=css>pc</code>&rsquo;
   999      <td>picas; 1pc is equal to 12pt
  1000   </table>
  1002   <pre class=example>
  1003 h1 { margin: 0.5in }      /* inches  */
  1004 h2 { line-height: 3cm }   /* centimeters */
  1005 h3 { word-spacing: 4mm }  /* millimeters */
  1006 h4 { font-size: 12pt }    /* points */
  1007 h4 { font-size: 1pc }     /* picas */
  1008 p  { font-size: 12px }    /* px */</pre>
  1010   <p>For a CSS device, these dimensions are either anchored (i) by relating
  1011    the physical units to their physical measurements, or (ii) by relating the
  1012    pixel unit to the <a href="#reference-pixel"><i>reference pixel</i></a>.
  1013    For print media and similar high-resolution devices, the anchor unit
  1014    should be one of the standard physical units (inches, centimeters, etc).
  1015    For lower-resolution devices, and devices with unusual viewing distances,
  1016    it is recommended instead that the anchor unit be the pixel unit. For such
  1017    devices it is recommended that the pixel unit refer to the whole number of
  1018    device pixels that best approximates the reference pixel.
  1020   <p class=note>Note that if the anchor unit is the pixel unit, the physical
  1021    units might not match their physical measurements. Alternatively if the
  1022    anchor unit is a physical unit, the pixel unit might not map to a whole
  1023    number of device pixels.
  1025   <p class=note>Note that this definition of the pixel unit and the physical
  1026    units differs from previous versions of CSS. In particular, in previous
  1027    versions of CSS the pixel unit and the physical units were not related by
  1028    a fixed ratio: the physical units were always tied to their physical
  1029    measurements while the pixel unit would vary to most closely match the
  1030    reference pixel. (This change was made because too much existing content
  1031    relies on the assumption of 96dpi, and breaking that assumption breaks the
  1032    content.)
  1034   <p>The <dfn id=reference-pixel>reference pixel</dfn> is the visual angle of
  1035    one pixel on a device with a pixel density of 96dpi and a distance from
  1036    the reader of an arm's length. For a nominal arm's length of 28 inches,
  1037    the visual angle is therefore about 0.0213 degrees. For reading at arm's
  1038    length, 1px thus corresponds to about 0.26&nbsp;mm (1/96&nbsp;inch).
  1040   <p>The image below illustrates the effect of viewing distance on the size
  1041    of a reference pixel: a reading distance of 71&nbsp;cm (28&nbsp;inches)
  1042    results in a reference pixel of 0.26&nbsp;mm, while a reading distance of
  1043    3.5&nbsp;m (12&nbsp;feet) results in a reference pixel of 1.3&nbsp;mm.
  1045   <div class=figure>
  1046    <p><img alt="This diagram illustrates how the definition of a pixel
  1047     depends on the users distance from the viewing surface (paper or screen).
  1048     The image depicts the user looking at two planes, one 28 inches (71 cm)
  1049     from the user, the second 140 inches (3.5 m) from the user. An expanding
  1050     cone is projected from the user's eye onto each plane. Where the cone
  1051     strikes the first plane, the projected pixel is 0.26 mm high. Where the
  1052     cone strikes the second plane, the projected pixel is 1.4 mm high."
  1053     src=pixel1.png>
  1055    <p class=caption>Showing that pixels must become larger if the viewing
  1056     distance increases
  1057   </div>
  1059   <p>This second image illustrates the effect of a device's resolution on the
  1060    pixel unit: an area of 1px by 1px is covered by a single dot in a
  1061    low-resolution device (e.g. a typical computer display), while the same
  1062    area is covered by 16 dots in a higher resolution device (such as a
  1063    printer).
  1065   <div class=figure>
  1066    <p><img alt="This diagram illustrates the relationship between the
  1067     reference pixel and device pixels (called &#34;dots&#34; below). The
  1068     image depicts a high resolution (large dot density) laser printer output
  1069     on the left and a low resolution monitor screen on the right. For the
  1070     laser printer, one square reference pixel is implemented by 16 dots. For
  1071     the monitor screen, one square reference pixel is implemented by a single
  1072     dot." src=pixel2.png>
  1074    <p class=caption>Showing that more device pixels (dots) are needed to
  1075     cover a 1px by 1px area on a high-resolution device than on a low-res one
  1077   </div>
  1079   <h2 id=other-units><span class=secno>7. </span> Other Units</h2>
  1081   <h3 id=angles><span class=secno>7.1. </span> Angles: the &lsquo;<a
  1082    href="#angle-value"><code class=css>&lt;angle&gt;</code></a>&rsquo; type
  1083    and &lsquo;<a href="#deg"><code class=css>deg</code></a>&rsquo;, &lsquo;<a
  1084    href="#grad"><code class=css>grad</code></a>&rsquo;, &lsquo;<a
  1085    href="#rad"><code class=css>rad</code></a>&rsquo;, &lsquo;<a
  1086    href="#turn"><code class=css>turn</code></a>&rsquo; units</h3>
  1088   <p>Angle values are <i>dimensions</i> denoted by <dfn
  1089    id=angle-value>&lt;angle&gt;</dfn>. The angle unit identifiers are:
  1091   <dl>
  1092    <dt><dfn id=deg title=deg>deg</dfn>
  1094    <dd>Degrees. There are 360 degrees in a full circle.
  1096    <dt><dfn id=grad title=grad>grad</dfn>
  1098    <dd>Gradians. There are 400 gradians in a full circle.
  1100    <dt><dfn id=rad title=rad>rad</dfn>
  1102    <dd>Radians. There are 2&pi; radians in a full circle. <span
  1103     class=issue>Who is going to use this anyway?</span>
  1105    <dt><dfn id=turn title=turn>turn</dfn>
  1107    <dd>Turns. There is 1 turn in a full circle.
  1108   </dl>
  1110   <p>For example, a right angle is &lsquo;<code class=css>90deg</code>&rsquo;
  1111    or &lsquo;<code class=css>100grad</code>&rsquo; or &lsquo;<code
  1112    class=css>0.25turn</code>&rsquo; or approximately &lsquo;<code
  1113    class=css>1.570796326794897rad</code>&rsquo;.
  1115   <h3 id=time><span class=secno>7.2. </span> Times: the &lsquo;<a
  1116    href="#time-value"><code class=css>&lt;time&gt;</code></a>&rsquo; type and
  1117    &lsquo;<a href="#s"><code class=css>s</code></a>&rsquo;, &lsquo;<a
  1118    href="#ms"><code class=css>ms</code></a>&rsquo; units</h3>
  1120   <p>Time values are <i>dimensions</i> denoted by <dfn
  1121    id=time-value>&lt;time&gt;</dfn>. The time unit identifiers are:
  1123   <dl>
  1124    <dt><dfn id=s title=s>s</dfn>
  1126    <dd>Seconds.
  1128    <dt><dfn id=ms title=ms>ms</dfn>
  1130    <dd>Milliseconds. There are 1000 milliseconds in a second.
  1131   </dl>
  1133   <p>Properties may restrict the time value to some range. If the value is
  1134    outside the allowed range, the declaration is invalid and must be <a
  1135    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
  1137   <h3 id=frequencies-the-ltfrequencygt-type-and-h><span class=secno>7.3.
  1138    </span>Frequencies: the &lsquo;<a href="#frequency-value"><code
  1139    class=css>&lt;frequency&gt;</code></a>&rsquo; type and &lsquo;<a
  1140    href="#hz"><code class=css>Hz</code></a>&rsquo;, &lsquo;<a
  1141    href="#khz"><code class=css>kHz</code></a>&rsquo; units</h3>
  1143   <p>Frequency values are <i>dimensions</i> denoted by <dfn
  1144    id=frequency-value>&lt;frequency&gt;</dfn>. The frequency unit identifiers
  1145    are:
  1147   <dl>
  1148    <dt><dfn id=hz title=Hz>Hz</dfn>
  1150    <dd>Hertz. It represents the number of occurrences per second.
  1152    <dt><dfn id=khz title=kHz>kHz</dfn>
  1154    <dd>KiloHertz. A kiloHertz is 1000 Hertz.
  1155     <p>For example, when representing sound pitches, 200Hz (or 200hz) is a
  1156      bass sound, and 6kHz (or 6khz) is a treble sound.</p>
  1158     <h4 id=the-calc-min-and-max-functions><span class=secno>7.3.1. </span>The
  1159      &lsquo;<a href="#calc"><code class=property>calc</code></a>&rsquo;,
  1160      &lsquo;<a href="#min"><code class=property>min</code></a>&rsquo; and
  1161      &lsquo;<a href="#max"><code class=property>max</code></a>&rsquo;
  1162      functions</h4>
  1164     <p>The <dfn id=calc>calc()</dfn>, <dfn id=min>min()</dfn>, and <dfn
  1165      id=max>max()</dfn> functions can be used wherever length, frequency,
  1166      angle, time, or number values are allowed.
  1168     <div class=example>
  1169      <pre>
  1170 section {
  1171   float: left;
  1172   margin: 1em; border: solid 1px;
  1173   width: calc(100%/3 - 2*1em - 2*1px);
  1175 </pre>
  1176     </div>
  1178     <div class=example>
  1179      <pre>
  1180 p {
  1181   margin: calc(1rem - 2px) calc(1rem - 1px);
  1183 </pre>
  1184     </div>
  1186     <div class=example>
  1187      <pre>
  1188 p { font-size: min(10px, 3em) }
  1189 blockquote { font-size: max(30px, 3em) }
  1190 </pre>
  1191     </div>
  1193     <div class=example>
  1194      <pre>
  1195 .box { width: min(10% + 20px, 300px) }
  1196 </pre>
  1197     </div>
  1199     <p>The expression language of these functions is described by the grammar
  1200      and prose below.
  1202     <pre>
  1203 S       : calc | min | max;
  1204 calc    : "calc(" S* sum ")" S*;
  1205 min     : "min(" S* sum [ "," S* sum ]* ")" S*;
  1206 max     : "max(" S* sum [ "," S* sum ]* ")" S*;
  1207 sum     : product [ [ "+" | "-" ] S* product ]*;
  1208 product : unit [ [ "*" | "/" | "mod" ] S* unit ]*;
  1209 unit    : ["+"|"-"]? [ NUMBER S* | DIMENSION S* | PERCENTAGE S* |
  1210           min | max | "(" S* sum ")" S* ];
  1211 </pre>
  1213     <p>The context of the expression imposes a target type, which is one of
  1214      length, frequency, angle, time, or number. NUMBER tokens are of type
  1215      number. DIMENSION tokens have types of their units (&lsquo;<code
  1216      class=property>cm</code>&rsquo; is length, &lsquo;<a href="#deg"><code
  1217      class=property>deg</code></a>&rsquo; is angle etc.); any DIMENSION whose
  1218      type does not match the target type is not allowed and must be a parse
  1219      error. If percentages are accepted in that context and convertible to
  1220      the target type, a PERCENTAGE token in the expression has the target
  1221      type; otherwise percentages are not allowed and must be a parse error.
  1223     <p>To make expressions simpler, operators have restrictions on the types
  1224      they accept. At each operator, the types of the left and right side have
  1225      to be checked for these restrictions. If compatible, they return roughly
  1226      as follows (the following ignores precedence rules on the operators for
  1227      simplicity):
  1229     <ol>
  1230      <li>At ",", "+", "-":<br>
  1231       check: both sides have the same type<br>
  1232       return: that type
  1234      <li>At "*":<br>
  1235       check: at least one side is "number" <br>
  1236       return: the type of the other side
  1238      <li>At "/":<br>
  1239       check: right side is "number"<br>
  1240       return: the type of the left side
  1241     </ol>
  1243     <p>Division by zero is a parse error.
  1245     <p>The value resulting from an expression must be clamped to the range
  1246      allowed in the target context.
  1248     <div class=example> These two are equivalentequivalent to &lsquo;<code
  1249      class=css>width: 0px</code>&rsquo; since widths smaller than 0px are not
  1250      allowed.
  1251      <pre>
  1252 width: calc(5px - 10px);
  1253 width: 0px;
  1254 </pre>
  1255     </div>
  1257     <p>Given the complexities of &lsquo;<code
  1258      class=property>width</code>&rsquo; and &lsquo;<code
  1259      class=property>height</code>&rsquo; on table cells and table elements,
  1260      calc() expressions for &lsquo;<code class=property>width</code>&rsquo;
  1261      and &lsquo;<code class=property>height</code>&rsquo; on table columns,
  1262      table column groups, table rows, table row groups, and table cells in
  1263      both auto and fixed layout tables are treated as if &lsquo;<code
  1264      class=property>auto</code>&rsquo; had been specified.
  1266     <h3 id=ltstringgt><span class=secno>7.4. </span>&lt;string&gt;</h3>
  1268     <p>Strings are denoted by <dfn id=ltstringgt0>&lt;string&gt;</dfn> in the
  1269      value definitions.
  1271     <h3 id=ltcolorgt><span class=secno>7.5. </span>&lt;color&gt;</h3>
  1273     <p><em>This section is not normative. The CSS3 Color module <a
  1274      href="#CSS3COLOR" rel=biblioentry>[CSS3COLOR]<!--{{!CSS3COLOR}}--></a>
  1275      defines the CSS3 color values.</em>
  1277     <p>Color values are denoted by <dfn id=ltcolorgt0>&lt;color&gt;</dfn> in
  1278      the value definitions.
  1280     <p>A <dfn id=color>color</dfn> value can either be a keyword, a numerical
  1281      specification in a functional notation, or a numerical RGB specification
  1282      in a hexadecimal notation. The hexadecimal notation is special shorthand
  1283      format that allows compact color descriptions.
  1285     <div class=example>
  1286      <pre>
  1287 em { color: #F00 }
  1288 span.issue { color: red }
  1289 * { color: hsl(120, 75%, 75%) } 
  1290 </pre>
  1291     </div>
  1293     <h3 id=ltattrgt><span class=secno>7.6. </span>&lt;attr&gt;</h3>
  1295     <p class=issue>Describe the feature fully here, not just a delta from CSS
  1296      21.
  1298     <p class=issue>When attr is set on a pseudo-element, it should apply to
  1299      the originating element
  1301     <p>In CSS2.1 <a href="#CSS21"
  1302      rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, the &lsquo;<code
  1303      class=css>attr()</code>&rsquo; expression always returns a string. In
  1304      CSS3, the &lsquo;<code class=css>attr()</code>&rsquo; expression can
  1305      return many different types. The new syntax for the attr() expression
  1306      is:
  1308     <pre>
  1309 'attr(' ident [ ',' &lt;type> [ ',' &lt;value> ]? ]? ')'
  1310 </pre>
  1312     <p>The first argument represents the attribute name. The value of the
  1313      attribute with that name on the element whose computed values are being
  1314      computed is used as the value of the expression, according to the rules
  1315      given below.
  1317     <p>The first argument accepts an optional namespace prefix to identify
  1318      the namespace of the attribute. The namespace prefix and the attribute
  1319      name is separated by &lsquo;<code class=css>|</code>&rsquo;, with no
  1320      whitespace before or after the separator <a href="#CSS3NAMESPACE"
  1321      rel=biblioentry>[CSS3NAMESPACE]<!--{{CSS3NAMESPACE}}--></a>.
  1323     <p>The second argument (which is optional but must be present if the
  1324      third argument is present) is a &lt;type> and tells the UA how to
  1325      interpret the attribute value. It may be one of the values from the list
  1326      below.
  1328     <p>The third argument (which is optional) is a CSS value which must be
  1329      valid where the attr() expression is placed. If it is not valid, then
  1330      the whole attr() expression is invalid.
  1332     <p>If the attribute named by the first argument is missing, cannot be
  1333      parsed, or is invalid for the property, then the value returned by
  1334      attr() will be the third argument, or, if the third argument is absent,
  1335      will be the value given as the default for the relevant type in the list
  1336      below.
  1338     <dl>
  1339      <dt>string
  1341      <dd>The attribute value will be interpreted as the contents of a CSS
  1342       string. The default is the empty string.
  1344      <dt>color
  1346      <dd>The attribute value will be interpreted as a CSS &lt;color> value.
  1347       The default is UA dependent but must be the same as the initial value
  1348       of the &lsquo;<a href="#color"><code
  1349       class=property>color</code></a>&rsquo; property.
  1351      <dt>url
  1353      <dd>The attribute value will be interpreted as the URI part of a
  1354       &lsquo;<code class=css>url()</code>&rsquo; expression. The default is a
  1355       UA-dependent URI defined to point to a non-existent document with a
  1356       generic error condition. (i.e. it shouldn't be an FTP URI that causes a
  1357       DNS error, or an HTTP URI that results in a 404, it should be a
  1358       nondescript error condition.)
  1360      <dt>integer
  1362      <dd>The attribute value will be interpreted as a CSS integer. The
  1363       default is 0. The default should also be used if the property in
  1364       question only accepts integers within a certain range and the attribute
  1365       is out of range.
  1367      <dt>number
  1369      <dd>The attribute value will be interpreted as a CSS number. The default
  1370       is 0.0. The default should also be used if the property in question
  1371       only accepts numbers within a certain range and the attribute is out of
  1372       range.
  1374      <dt>length, angle, time, frequency
  1376      <dd>The attribute value will be interpreted as a CSS length, angle, time
  1377       or frequency (respectively), and the unit identifier (if any) will
  1378       appear in the attribute value. The default is 0. The default should
  1379       also be used if the property in question only accepts values within a
  1380       certain range (e.g. positive lengths or angles from 0 to 90deg) and the
  1381       attribute is out of range (e.g. a negative length or 180deg).
  1383      <dt>em, ex, px, gr, rem, vw, vh, vm, mm, cm, in, pt, pc, deg, grad, rad,
  1384       ms, s, Hz, kHz, %
  1386      <dd>The attribute value will be interpreted as a float, with the given
  1387       type suffixed as a unit. The default is 0 in the relevant units.
  1388     </dl>
  1390     <p class=issue>Should there also be a "keyword" type to, e.g., support
  1391      &lsquo;<code class=css>float: attr(align)</code>&rsquo;</p>
  1393     <p>If the &lt;type> is missing, &lsquo;<a href="#string"><code
  1394      class=property>string</code></a>&rsquo; is implied.
  1396     <p class=issue>Ideally, it shouldn't be necessary to specify the type if
  1397      it is obvious. For example, this should be valid: "<tt>background-image:
  1398      attr(href);</tt>". This could be described as: <q>If the property only
  1399      accepts one type of value (aside from &lsquo;<code
  1400      class=property>inherit</code>&rsquo; and &lsquo;<code
  1401      class=property>initial</code>&rsquo;), that type is implied</q>.
  1403     <p>The attr() form is only valid if the type given (or implied, if it is
  1404      missing) is valid for the property. For example, all of the following
  1405      are invalid and would cause a parse-time error (and thus cause the
  1406      relevant declaration, in this case all of them, to be ignored):
  1408     <div class="illegal example">
  1409      <p style="display:none">Illegal Examples:
  1411      <pre>
  1412       content: attr(title, color); /* 'content' doesn't accept colors */
  1414       content: attr(end-of-quote, string, inherit) close-quote; /* the
  1415       'inherit' value is not allowed there, since the result would be
  1416       'inherit close-quote', which is invalid. */
  1418       margin: attr(vertical, length) attr(horizontal, deg); /* deg
  1419       units are not valid at that point */
  1420 <!--
  1421       font: attr(weight, integer) attr(size, length)/attr(height,
  1422       integer) attr(family, string); /* invalid because
  1423       &lt;'font-weight'>s are not integers, but identifiers. */
  1424 -->
  1425       color: attr(color); /* 'color' doesn't accept strings */
  1426 </pre>
  1427     </div>
  1429     <p>The attr() expression cannot return everything, for example it cannot
  1430      do counters, named strings, quotes, or values such as &lsquo;<code
  1431      class=property>auto</code>&rsquo;, &lsquo;<code
  1432      class=property>nowrap</code>&rsquo;, or &lsquo;<code
  1433      class=property>baseline</code>&rsquo;. This is intentional, as the
  1434      intent of the &lsquo;<code class=css>attr()</code>&rsquo; expression is
  1435      not to make it possible to describe a presentational language's
  1436      formatting using CSS, but to enable CSS to take semantic data into
  1437      account.
  1439     <p>Note that the default value need not be of the type given. For
  1440      instance, if the type required of the attribute by the author is
  1441      &lsquo;<code class=property>px</code>&rsquo;, the default could still be
  1442      &lsquo;<code class=css>5em</code>&rsquo;.
  1444     <div class=example>
  1445      <p>Examples:
  1447      <pre>
  1448       &lt;stock>
  1449         &lt;wood length="12"/>
  1450         &lt;wood length="5"/>
  1451         &lt;metal length="19"/>
  1452         &lt;wood length="4"/>
  1453       &lt;/stock>
  1455       stock::before {
  1456         display: block;
  1457         content: "To scale, the lengths of materials in stock are:";
  1459       stock > * {
  1460         display: block;
  1461         width: attr(length, em); /* default 0 */
  1462         height: 1em;
  1463         border: solid thin;
  1464         margin: 0.5em;
  1466       wood {
  1467         background: orange url(wood.png);
  1469       metal {
  1470         background: silver url(metal.png);
  1473       /* this also uses a possible extension to the 'content' property
  1474       to handle replaced content and alternatives to unavailable,
  1475       corrupted or unsupported content */
  1476       img {
  1477          content: replaced attr(src, url), attr(alt, string, none);
  1478          height: attr(height, px, auto);
  1479          width: attr(width, px, auto);
  1481 </pre>
  1482     </div>
  1484     <p>The attr() expression cannot currently fall back onto another
  1485      attribute. Future versions of CSS may extend attr() in this direction.
  1487     <p class=issue>Should &lsquo;<code class=css>attr()</code>&rsquo; be
  1488      allowed on any property, in any source language? For example, do we
  1489      expect UAs to honor this rule for HTML documents?: <tt>P[COLOR] { color:
  1490      attr(COLOR, color) }</tt>.
  1492     <h3 id=uris><span class=secno>7.7. </span>&lt;url&gt;</h3>
  1494     <p><dfn id=urls title="Uniform Resource Locator (URL)|URL (Uniform
  1495      Resource Locator)">URLs</dfn> (Uniform Resource Locators, see <a
  1496      href="#RFC1738" rel=biblioentry>[RFC1738]<!--{{RFC1738}}--></a> and <a
  1497      href="#RFC1808" rel=biblioentry>[RFC1808]<!--{{RFC1808}}--></a>) provide
  1498      the address of a resource on the Web. An alternative and more general
  1499      term is <dfn id=uris0 title="Resource Identifier (URI)|URI (Uniform
  1500      Resource Identifier)">URIs</dfn> (Uniform Resource Identifiers, see
  1501      [!URI]). This specification uses the term URI.</p>
  1503     <p>For historical reasons, the name of the URI function is "url". The URI
  1504      function takes one URI as the argument. The URI may be quoted with
  1505      single quote (&apos;) or double quote (&quot;) characters. If quoted,
  1506      the two quote characters must be the same.
  1508     <div class=example>
  1509      <p style="display:none">Example(s):</p>
  1511      <pre>
  1512 body { background: url("http://www.example.com/pinkish.gif") }
  1513 </pre>
  1514     </div>
  1516     <div class=example>
  1517      <p>An example without quotes:</p>
  1519      <pre>
  1520 li { list-style: url(http://www.example.com/redball.png) disc }
  1521 </pre>
  1522     </div>
  1524     <p>Parentheses, commas, whitespace characters, single quotes
  1525      (&lsquo;<code class=css>) and double quotes ("<!--"-->) appearing in a
  1526      URI must be escaped with a backslash: </code>&rsquo;\(&lsquo;<code
  1527      class=css>, </code>&rsquo;\)&lsquo;<code class=css>,
  1528      </code>&rsquo;\,&lsquo;<code class=css>.</code></p>
  1530     <p>Depending on the type of URI, it might also be possible to write the
  1531      above characters as URI-escapes (where "(" = %28, ")" = %29, etc.) as
  1532      described in [!URI].</p>
  1534     <p>In order to create modular style sheets that are not dependent on the
  1535      absolute location of a resource, authors should use relative URIs.
  1536      Relative URIs (as defined in <a href="#RFC1808"
  1537      rel=biblioentry>[RFC1808]<!--{{RFC1808}}--></a>) are resolved to full
  1538      URIs using a base URI. RFC&nbsp;1808, section&nbsp;3, defines the
  1539      normative algorithm for this process. For CSS style sheets, the base URI
  1540      is that of the style sheet, not that of the source document.</p>
  1542     <div class=example>
  1543      <p>For example, suppose the following rule:</p>
  1545      <pre>
  1546 body { background: url("yellow") }
  1547 </pre>
  1549      <p>is located in a style sheet designated by the URI:</p>
  1551      <pre>
  1552 http://www.example.org/style/basic.css
  1553 </pre>
  1555      <p>The background of the source document&rsquo;s BODY will be tiled with
  1556       whatever image is described by the resource designated by the URI</p>
  1558      <pre>
  1559 http://www.example.org/style/yellow
  1560 </pre>
  1561     </div>
  1563     <p>User agents may vary in how they handle URIs that designate
  1564      unavailable or inapplicable resources.</p>
  1566     <h3 id=ltimagegt><span class=secno>7.8. </span>&lt;image&gt;</h3>
  1568     <p>TBD. <!--
  1569 <h4>The 'counter' function</h4>
  1571 <p><dfn title="&lt;counter&gt;, definition of">Counters</dfn> are denoted by
  1572 identifiers (see the <span class="property">'counter-increment'</span> and
  1573 <span class="property">'counter-reset'</span> properties). To refer to the
  1574 value of a counter, the notation <dfn>'counter(&lt;identifier&gt;)'</dfn> or
  1575 <dfn>'counter(&lt;identifier&gt;, &lt;list-style-type&gt;)'</dfn> is used.
  1576 The default style is 'decimal'.</p>
  1578 <p>To refer to a sequence of nested counters of the same name, the notation
  1579 is 'counters(&lt;identifier&gt;, &lt;string&gt;)' or
  1580 'counters(&lt;identifier&gt;, &lt;string&gt;, &lt;list-style-type&gt;)'. See
  1581 "Nested counters and scope" [add ref] in the chapter on generated content
  1582 [add ref].</p>
  1584 <p>In CSS2.1, the values of counters can only be referred to from the <span
  1585 class="property">'content'</span> property. Note that 'none' is a possible
  1586 &lt;list-style-type&gt;: 'counter(x, none)' yields an empty string.</p>
  1588 <div class="example">
  1589 <p style="display:none">Example(s):</p>
  1591 <p>Here is a style sheet that numbers paragraphs (P) for each chapter (H1).
  1592 The paragraphs are numbered with roman numerals, followed by a period and a
  1593 space:</p>
  1595 <pre>
  1596 p { counter-increment: par-num }
  1597 h1 { counter-reset: par-num }
  1598 p:before { content: counter(par-num, upper-roman) ". " }
  1599 </pre>
  1600 </div>
  1601 -->
  1604     <h3 id=ltfractiongt><span class=secno>7.9. </span>&lt;fraction&gt;</h3>
  1606     <p>Some properties accept a series of length values that, in sum, should
  1607      add up to a certain length. To take up any remaining space, fractions
  1608      can be used.
  1610     <h4 id=the-fr-unit><span class=secno>7.9.1. </span>The &lsquo;<code
  1611      class=property>fr</code>&rsquo; unit</h4>
  1613     <p>The <dfn id=fr title="fr (unit)">fr</dfn> unit is used to distribute
  1614      any remaining space in a series of length values. If multiple fractions
  1615      are specified, they take up space proportionally to their numeric value.
  1618     <div class=example>
  1619      <pre>
  1620 border-parts: 10px 1fr 10px;
  1621 border-parts: 10px 1fr 10px 1fr 10px;
  1622 border-parts: 10px 2fr 10px 2fr 10px;
  1623 </pre>
  1624     </div>
  1626     <p>The &lsquo;<code class=css>fr</code>&rsquo; unit can only be used in
  1627      combination with regular length units.
  1629     <h3 id=ltgridgt><span class=secno>7.10. </span>&lt;grid&gt;</h3>
  1631     <p>A grid is a set of invisible vertical and horizontal lines that can be
  1632      used to align content. In CSS3, a grid lines can be established
  1633      implicitly or explicitly <a href="#CSS3COL"
  1634      rel=biblioentry>[CSS3COL]<!--{{!CSS3COL}}--></a> <a href="#CSS3GRID"
  1635      rel=biblioentry>[CSS3GRID]<!--{{!CSS3GRID}}--></a>. In any case, the
  1636      distance between grid lines can be referred to by the &lsquo;<code
  1637      class=css>gr</code>&rsquo; unit.
  1639     <h4 id=the-gr-unit><span class=secno>7.10.1. </span>The &lsquo;<code
  1640      class=property>gr</code>&rsquo; unit</h4>
  1642     <p>The <dfn id=gr title="gr (unit)">gr</dfn> unit is used to position
  1643      elements in relation to grid lines.
  1645     <div class=example>
  1646      <pre>
  1647 img { 
  1648   float: top left multicol; 
  1649   float-offset: 2gr; 
  1650   width: 1gr }
  1652 </pre>
  1653     </div>
  1655     <p>Grid lines can be laid out in uneven patterns. Therefore, the
  1656      &lsquo;<code class=css>gr</code>&rsquo; unit is not linear.
  1658     <div class=example>
  1659      <p>For example, "2gr" is not necessarily twice as long as "1gr".
  1660     </div>
  1661     <!--
  1663 <h3>Special cases</h3>
  1665 <p>Two common types of values fall outside the types
  1666 described above: the value for font families and the hexadecimal color
  1667 notation.
  1669 <h4>Font families</h4>
  1671 <p>The <span class="property">'font'</span>
  1672 and <span class="property">'font-family'</span> properties accept a
  1673 comma-separated list of font families. Font families can either be the
  1674 name of a certain font, or it can be one of
  1675 five <em class="index">generic font families</em>: 'serif',
  1676 'sans-serif', 'cursive','fantasy', and 'monospace'. Font family names
  1677 are like strings, except that the quotes around them may be omitted.
  1678 If quoting is omitted, any white space characters before and after the
  1679 font name are ignored and any sequence of white space characters
  1680 inside the font name is converted to a single space. Font family names
  1681 that happen to be the same as a keyword value (e.g. 'initial',
  1682 'inherit', 'default', 'serif', 'sans-serif', 'monospace', 'fantasy',
  1683 and 'cursive') must be quoted to prevent confusion with the keywords
  1684 with the same names. UAs must not consider these keywords as matching
  1685 the ''&lt;family-name&gt;'' type.
  1687 <p>Generic font family names are keywords and must not be quoted.
  1689 <div class="example">
  1690 <pre>body { font-family: "Helvetica", "Univers", "Arial", sans-serif }</pre>
  1691 </div>
  1692 -->
  1694     <h2 id=specified-computed-used-and-actual-value><span class=secno>8.
  1695      </span>Specified, computed, used, and actual values</h2>
  1697     <p>The final value of a CSS3 property for a given element is the result
  1698      of a four-step calculation. First, cascading and inheritance yields the
  1699      <a href="#specified-value"><em>specified value</em></a> <a
  1700      href="#CSS3CASCADE"
  1701      rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>. Second,
  1702      relative values are computed into absolute values as far as possible
  1703      without formatting the document, thereby yielding the <a
  1704      href="#computed-value"><em>computed value</em></a>. The computed value
  1705      is transformed into the <a href="#used-value"><em>used value</em></a> in
  1706      the formatting process. Finally, the computed value is transformed to
  1707      the <a href="#actual-value"><em>actual value</em></a> based on
  1708      constraints in the user agent.</p>
  1710     <h3 id=finding-the-specified-value><span class=secno>8.1. </span>Finding
  1711      the <dfn id=specified-value>specified value</dfn></h3>
  1713     <p>The <a href="#specified-value"><em>specified value</em></a> is the
  1714      output of the cascading and inheritance process <a href="#CSS3CASCADE"
  1715      rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>.
  1717     <h3 id=finding-the-computed-value><span class=secno>8.2. </span>Finding
  1718      the <dfn id=computed-value>computed value</dfn></h3>
  1720     <p>Specified values may be absolute (i.e., they are not specified
  1721      relative to another value, as in &lsquo;<code
  1722      class=property>red</code>&rsquo; or &lsquo;<code
  1723      class=css>2mm</code>&rsquo;) or relative (i.e., they are specified
  1724      relative to another value, as in &lsquo;<code
  1725      class=property>auto</code>&rsquo;, &lsquo;<code
  1726      class=css>2em</code>&rsquo;). For absolute values, no processing is
  1727      needed to find the computed value.</p>
  1729     <p>For relative values, on the other hand, computation is necessary to
  1730      find the computed values: percentages must be multiplied by a reference
  1731      value (each property defines which value that is), values with relative
  1732      units (em, ex, px) must be made absolute by multiplying with the
  1733      appropriate font or pixel size, &lsquo;<code
  1734      class=property>auto</code>&rsquo; values must be computed by the
  1735      formulas given with each property, certain keywords (e.g., &lsquo;<code
  1736      class=property>smaller</code>&rsquo;, &lsquo;<code
  1737      class=property>bolder</code>&rsquo;) must be replaced according to their
  1738      definitions. See example (f), (g) and (h) in the table below.</p>
  1740     <p>Also, relative URIs are computed into absolute URIs at this stage. The
  1741      computed value of invalid and absolute URIs is the same as the specified
  1742      value.
  1744     <h3 id=finding-the-used-value><span class=secno>8.3. </span>Finding the
  1745      <dfn id=used-value>used value</dfn></h3>
  1747     <p>Computed values are processed as far as possible without formatting
  1748      the document. Some values, however, can only be determined when the
  1749      document is being laid out. For example, if the width of an element is
  1750      set to be a certain percentage of its containing block, the width cannot
  1751      be determined until the width of the containing block has been
  1752      determined. The used value is the result of taking the computed value
  1753      and resolving any remaining dependencies into an absolute value.
  1755     <h3 id=finding-the-actual-value><span class=secno>8.4. </span>Finding the
  1756      <dfn id=actual-value>actual value</dfn></h3>
  1758     <p>A used value is in principle ready to be used, but a user agent may
  1759      not be able to make use of the value in a given environment. For
  1760      example, a user agent may only be able to render borders with integer
  1761      pixel widths and may therefore have to approximate the computed width.
  1762      Also, the font size of an element may need adjustment based on the
  1763      availability of fonts or the value of the &lsquo;<code
  1764      class=property>font-size-adjust</code>&rsquo; property. The actual value
  1765      is the computed value after adjustments have been made.
  1767     <p>By probing the actual values of elements, much can be learned about
  1768      how the document is laid out. However, not all information is recorded
  1769      in the actual values. For example, the actual value of the &lsquo;<code
  1770      class=property>page-break-after</code>&rsquo; property does not reflect
  1771      whether there is a page break or not after the element. Similarly, the
  1772      actual value of &lsquo;<code class=property>orphans</code>&rsquo; does
  1773      not reflect how many orphan lines there is in a certain element. See
  1774      examples (j) and (k) in the table below.
  1776     <table>
  1777      <tbody>
  1778       <tr>
  1779        <th>Example
  1781        <th>Winning declaration
  1783        <th>Property</th>
  1784        <!--      <th>Cascaded value</th>  -->
  1786        <th>Specified value
  1788        <th>Computed value
  1790        <th>Used value
  1792        <th>Actual value
  1794       <tr>
  1795        <td>a
  1797        <td><tt class=declaration>text-align: left</tt>
  1799        <td>text-align</td>
  1800        <!--      <td>left</td>-->
  1802        <td>left
  1804        <td>left
  1806        <td>left
  1808        <td>left
  1810       <tr>
  1811        <td>b
  1813        <td><tt class=declaration>border-width: inherit</tt>
  1815        <td>border-top-width, border-right-width, border-bottom-width,
  1816         border-left-width</td>
  1817        <!--      <td>inherit</td> -->
  1819        <td class=say>4.2px
  1821        <td>4.2px
  1823        <td>4.2px
  1825        <td>4px
  1827       <tr>
  1828        <td>c
  1830        <td>(no winning declaration)
  1832        <td>width</td>
  1833        <!--      <td>(no specified value)</td>-->
  1835        <td>auto (initial&nbsp;value)
  1837        <td>auto
  1839        <td>120px
  1841        <td>120px
  1843       <tr>
  1844        <td>d
  1846        <td><tt class=declaration>list-style-position: inherit</tt>
  1848        <td>list-style-position</td>
  1849        <!--      <td>inherit</td> -->
  1851        <td class=say>inside
  1853        <td>inside
  1855        <td>inside
  1857        <td>inside
  1859       <tr>
  1860        <td>e
  1862        <td><tt class=declaration>list-style-position: initial</tt>
  1864        <td>list-style-position</td>
  1865        <!--      <td>initial</td>-->
  1867        <td>outside (initial&nbsp;value)
  1869        <td>outside
  1871        <td>outside
  1873        <td>outside
  1875       <tr>
  1876        <td>f
  1878        <td><tt class=declaration>font-size: 1.2em</tt>
  1880        <td>font-size</td>
  1881        <!--      <td>1.2em</td>-->
  1883        <td>1.2em
  1885        <td class=say>14.1px
  1887        <td>14.1px
  1889        <td>14px
  1891       <tr>
  1892        <td>g
  1894        <td><tt class=declaration>width: 80%</tt>
  1896        <td>width</td>
  1897        <!--      <td>80%</td>-->
  1899        <td>80%
  1901        <td>80%
  1903        <td class=say>354.2px
  1905        <td>354px
  1907       <tr>
  1908        <td>h
  1910        <td><tt class=declaration>width: auto</tt>
  1912        <td>width</td>
  1913        <!--      <td>auto</td>-->
  1915        <td>auto
  1917        <td>auto
  1919        <td class=say>134px
  1921        <td>134px
  1923       <tr>
  1924        <td>i
  1926        <td><tt class=declaration>height: auto</tt>
  1928        <td>height</td>
  1929        <!--      <td>auto</td>-->
  1931        <td>auto
  1933        <td>auto
  1935        <td class=say>176px
  1937        <td>176px
  1939       <tr>
  1940        <td>j
  1942        <td>(no winning declaration)
  1944        <td>page-break-after</td>
  1945        <!--      <td>(no specified value)</td>-->
  1947        <td>auto (initial&nbsp;value)
  1949        <td>auto
  1951        <td>auto
  1953        <td>auto
  1955       <tr>
  1956        <td>k
  1958        <td><tt class=declaration>orphans: 3</tt>
  1960        <td>orphans</td>
  1961        <!--      <td>3</td>-->
  1963        <td>3
  1965        <td>3
  1967        <td>3
  1969        <td>3
  1970     </table>
  1972     <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
  1974     <p>Comments and suggestions from Giovanni Campagna, Christoph P&auml;per,
  1975      Keith Rarick, Alex Mogilevsky, Ian Hickson, David Baron, Edward
  1976      Welbourne, Boris Zbarsky, Bj&ouml;rn H&ouml;hrmann and Michael Day
  1977      improved this module. <!--
  1979 Ian's proposal:
  1980   http://lists.w3.org/Archives/Member/w3c-css-wg/2002OctDec/0141.html
  1981 David's proposal
  1982   http://lists.w3.org/Archives/Member/w3c-css-wg/2002OctDec/0191.html
  1984 -->
  1987     <h2 class=no-num id=references>References</h2>
  1989     <h3 class=no-num id=normative-references>Normative references</h3>
  1990     <!--begin-normative--> <!-- Sorted by label -->
  1991     <dl class=bibliography>
  1992      <dt style="display:
  1993       none"><!-- keeps the doc valid if the DL is empty --> <!---->
  1995      <dt id=CSS21>[CSS21]
  1997      <dd>Bert Bos; et al. <a
  1998       href="http://www.w3.org/TR/2011/REC-CSS2-20110607"><cite>Cascading
  1999       Style Sheets Level 2 Revision 1 (CSS&#160;2.1)
  2000       Specification.</cite></a> 7 June 2011. W3C Recommendation. URL: <a
  2001       href="http://www.w3.org/TR/2011/REC-CSS2-20110607">http://www.w3.org/TR/2011/REC-CSS2-20110607</a>
  2002       </dd>
  2003      <!---->
  2005      <dt id=CSS3CASCADE>[CSS3CASCADE]
  2007      <dd>H&#229;kon Wium Lie. <a
  2008       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215"><cite>CSS3
  2009       module: Cascading and inheritance.</cite></a> 15 December 2005. W3C
  2010       Working Draft. (Work in progress.) URL: <a
  2011       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215">http://www.w3.org/TR/2005/WD-css3-cascade-20051215</a>
  2012       </dd>
  2013      <!---->
  2015      <dt id=CSS3COL>[CSS3COL]
  2017      <dd>H&#229;kon Wium Lie. <a
  2018       href="http://www.w3.org/TR/2011/CR-css3-multicol-20110412"><cite>CSS
  2019       Multi-column Layout Module.</cite></a> 12 April 2011. W3C Candidate
  2020       Recommendation. (Work in progress.) URL: <a
  2021       href="http://www.w3.org/TR/2011/CR-css3-multicol-20110412">http://www.w3.org/TR/2011/CR-css3-multicol-20110412</a>
  2022       </dd>
  2023      <!---->
  2025      <dt id=CSS3COLOR>[CSS3COLOR]
  2027      <dd>Tantek &#199;elik; Chris Lilley; L. David Baron. <a
  2028       href="http://www.w3.org/TR/2011/REC-css3-color-20110607"><cite>CSS
  2029       Color Module Level 3.</cite></a> 7 June 2011. W3C Recommendation. URL:
  2030       <a
  2031       href="http://www.w3.org/TR/2011/REC-css3-color-20110607">http://www.w3.org/TR/2011/REC-css3-color-20110607</a>
  2032       </dd>
  2033      <!---->
  2035      <dt id=CSS3GRID>[CSS3GRID]
  2037      <dd>Alex Mogilevsky; Markus Mielke. <a
  2038       href="http://www.w3.org/TR/2007/WD-css3-grid-20070905"><cite>CSS Grid
  2039       Positioning Module Level&#160;3.</cite></a> 5 September 2007. W3C
  2040       Working Draft. (Work in progress.) URL: <a
  2041       href="http://www.w3.org/TR/2007/WD-css3-grid-20070905">http://www.w3.org/TR/2007/WD-css3-grid-20070905</a>
  2042       </dd>
  2043      <!---->
  2044     </dl>
  2045     <!--end-normative-->
  2046     <h3 class=no-num id=other-references>Other references</h3>
  2047     <!--begin-informative--> <!-- Sorted by label -->
  2048     <dl class=bibliography>
  2049      <dt style="display:
  2050       none"><!-- keeps the doc valid if the DL is empty --> <!---->
  2052      <dt id=CSS3CASCADE>[CSS3CASCADE]
  2054      <dd>H&#229;kon Wium Lie. <a
  2055       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215"><cite>CSS3
  2056       module: Cascading and inheritance.</cite></a> 15 December 2005. W3C
  2057       Working Draft. (Work in progress.) URL: <a
  2058       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215">http://www.w3.org/TR/2005/WD-css3-cascade-20051215</a>
  2059       </dd>
  2060      <!---->
  2062      <dt id=CSS3NAMESPACE>[CSS3NAMESPACE]
  2064      <dd>Elika J. Etemad; Anne van Kesteren. <a
  2065       href="http://www.w3.org/TR/2008/CR-css3-namespace-20080523/"><cite>CSS
  2066       Namespaces Module.</cite></a> 23 May 2008. W3C Candidate
  2067       Recommendation. (Work in progress.) URL: <a
  2068       href="http://www.w3.org/TR/2008/CR-css3-namespace-20080523/">http://www.w3.org/TR/2008/CR-css3-namespace-20080523/</a>
  2069       </dd>
  2070      <!---->
  2072      <dt id=RFC1738>[RFC1738]
  2074      <dd>T. Berners-Lee; L. Masinter; M. McCahill. <a
  2075       href="http://www.ietf.org/rfc/rfc1738.txt"><cite>Uniform Resource
  2076       Locators (URL).</cite></a> December 1994. Internet RFC 1738. URL: <a
  2077       href="http://www.ietf.org/rfc/rfc1738.txt">http://www.ietf.org/rfc/rfc1738.txt</a>
  2078       </dd>
  2079      <!---->
  2081      <dt id=RFC1808>[RFC1808]
  2083      <dd>R. Fielding. <a
  2084       href="http://www.ietf.org/rfc/rfc1808.txt"><cite>Relative Uniform
  2085       Resource Locators.</cite></a> June 1995. Internet RFC 1808. (Obsoleted
  2086       by RFC 3986) URL: <a
  2087       href="http://www.ietf.org/rfc/rfc1808.txt">http://www.ietf.org/rfc/rfc1808.txt</a>
  2088       </dd>
  2089      <!---->
  2090     </dl>
  2091     <!--end-informative-->
  2092     <h2 class=no-num id=index>Index</h2>
  2093     <!--begin-index-->
  2094     <ul class=indexlist>
  2095      <li>absolute length units, <a href="#absolute-length-units"
  2096       title="absolute length units"><strong>6.2.</strong></a>
  2098      <li>actual value, <a href="#actual-value" title="actual
  2099       value"><strong>8.4.</strong></a>
  2101      <li>&lt;angle&gt;, <a href="#angle-value"
  2102       title="&lt;angle&gt;"><strong>7.1.</strong></a>
  2104      <li>calc(), <a href="#calc" title="calc()"><strong>7.3.1.</strong></a>
  2106      <li>ch, <a href="#ch-unit" title=ch><strong>6.1.1.</strong></a>
  2108      <li>color, <a href="#color" title=color><strong>7.5.</strong></a>
  2110      <li>&lt;color&gt;, <a href="#ltcolorgt0"
  2111       title="&lt;color&gt;"><strong>7.5.</strong></a>
  2113      <li>compound value, <a href="#compound-value" title="compound
  2114       value"><strong>3.2.</strong></a>
  2116      <li>computed value, <a href="#computed-value" title="computed
  2117       value"><strong>8.2.</strong></a>
  2119      <li>deg, <a href="#deg" title=deg><strong>7.1.</strong></a>
  2121      <li>dimension, <a href="#dimension"
  2122       title=dimension><strong>6.</strong></a>
  2124      <li>em, <a href="#em-unit" title=em><strong>6.1.1.</strong></a>
  2126      <li>ex, <a href="#ex-unit" title=ex><strong>6.1.1.</strong></a>
  2128      <li>&lt;frequency&gt;, <a href="#frequency-value"
  2129       title="&lt;frequency&gt;"><strong>7.3.</strong></a>
  2131      <li>fr (unit), <a href="#fr" title="fr
  2132       (unit)"><strong>7.9.1.</strong></a>
  2134      <li>functional notation, <a href="#functional-notation0"
  2135       title="functional notation"><strong>3.2.</strong></a>
  2137      <li>grad, <a href="#grad" title=grad><strong>7.1.</strong></a>
  2139      <li>gr (unit), <a href="#gr" title="gr
  2140       (unit)"><strong>7.10.1.</strong></a>
  2142      <li>Hz, <a href="#hz" title=Hz><strong>7.3.</strong></a>
  2144      <li>identifier, <a href="#identifier"
  2145       title=identifier><strong>4.</strong></a>
  2147      <li><a href="#identifier-value"><code>&lt;identifier&gt;</code></a>, <a
  2148       href="#identifier-value"
  2149       title="&lt;identifier&gt;"><strong>4.2.</strong></a>
  2151      <li>&lsquo;<code class=css>inherit</code>&rsquo;, <a href="#inherit"
  2152       title="''inherit''"><strong>4.1.1.</strong></a>
  2154      <li>&lsquo;<code class=css>initial</code>&rsquo;, <a href="#initial"
  2155       title="''initial''"><strong>4.1.1.</strong></a>
  2157      <li>integer, <a href="#integer" title=integer><strong>5.1.</strong></a>
  2159      <li><a href="#integer-value"><code>&lt;integer&gt;</code></a>, <a
  2160       href="#integer-value" title="&lt;integer&gt;"><strong>5.1.</strong></a>
  2163      <li>kHz, <a href="#khz" title=kHz><strong>7.3.</strong></a>
  2165      <li><a href="#length-value"><code>&lt;length&gt;</code></a>, <a
  2166       href="#length-value" title="&lt;length&gt;"><strong>6.</strong></a>
  2168      <li>max(), <a href="#max" title="max()"><strong>7.3.1.</strong></a>
  2170      <li>min(), <a href="#min" title="min()"><strong>7.3.1.</strong></a>
  2172      <li>ms, <a href="#ms" title=ms><strong>7.2.</strong></a>
  2174      <li>newline, <a href="#newline" title=newline>3.1.</a>
  2176      <li>number, <a href="#number" title=number><strong>5.2.</strong></a>
  2178      <li><a href="#number-value"><code>&lt;number&gt;</code></a>, <a
  2179       href="#number-value" title="&lt;number&gt;"><strong>5.2.</strong></a>
  2181      <li><a href="#percentage-value"><code>&lt;percentage&gt;</code></a>, <a
  2182       href="#percentage-value"
  2183       title="&lt;percentage&gt;"><strong>5.3.</strong></a>
  2185      <li>rad, <a href="#rad" title=rad><strong>7.1.</strong></a>
  2187      <li>reference pixel, <a href="#reference-pixel" title="reference
  2188       pixel"><strong>6.2.</strong></a>
  2190      <li>relative length, <a href="#relative-length-units" title="relative
  2191       length"><strong>6.1.</strong></a>
  2193      <li>rem, <a href="#rem-unit" title=rem><strong>6.1.1.</strong></a>
  2195      <li>Resource Identifier (URI), <a href="#uris0" title="Resource
  2196       Identifier (URI)"><strong>7.7.</strong></a>
  2198      <li>s, <a href="#s" title=s><strong>7.2.</strong></a>
  2200      <li>simple value, <a href="#simple-value" title="simple
  2201       value"><strong>3.2.</strong></a>
  2203      <li>specified value, <a href="#specified-value" title="specified
  2204       value"><strong>8.1.</strong></a>
  2206      <li>string, <a href="#string" title=string><strong>3.1.</strong></a>
  2208      <li>&lt;string&gt;, <a href="#ltstringgt0"
  2209       title="&lt;string&gt;"><strong>7.4.</strong></a>
  2211      <li>&lt;time&gt;, <a href="#time-value"
  2212       title="&lt;time&gt;"><strong>7.2.</strong></a>
  2214      <li>turn, <a href="#turn" title=turn><strong>7.1.</strong></a>
  2216      <li>Uniform Resource Locator (URL), <a href="#urls" title="Uniform
  2217       Resource Locator (URL)"><strong>7.7.</strong></a>
  2219      <li>URI (Uniform Resource Identifier), <a href="#uris0" title="URI
  2220       (Uniform Resource Identifier)"><strong>7.7.</strong></a>
  2222      <li>URL (Uniform Resource Locator), <a href="#urls" title="URL (Uniform
  2223       Resource Locator)"><strong>7.7.</strong></a>
  2225      <li>used value, <a href="#used-value" title="used
  2226       value"><strong>8.3.</strong></a>
  2228      <li>vh, <a href="#vh-unit" title=vh><strong>6.1.2.</strong></a>
  2230      <li>vm, <a href="#vm-unit" title=vm><strong>6.1.2.</strong></a>
  2232      <li>vw, <a href="#vw-unit" title=vw><strong>6.1.2.</strong></a>
  2233     </ul>
  2234     <!--end-index-->
  2235   </dl>

mercurial