css3-values/Overview.html

Wed, 10 Aug 2011 23:45:29 +0000

author
Elika Etemad <fantasai.cvs@inkedblade.net>
date
Wed, 10 Aug 2011 23:45:29 +0000
changeset 3292
324c6ef7c447
parent 3291
8e1babb965e4
child 3293
c38cec6b116e
permissions
-rw-r--r--

Generic Datatype Reorganization Part V: Strings and URLs
Also, create a cleaner split between this module and syntax.

     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="#functional-notation"><span class=secno>3.1.
   169       </span>Functional notation</a>
   170     </ul>
   172    <li><a href="#textual-values"><span class=secno>4. </span> Textual Data
   173     Types</a>
   174     <ul class=toc>
   175      <li><a href="#keywords"><span class=secno>4.1. </span> Pre-defined
   176       Keywords</a>
   177       <ul class=toc>
   178        <li><a href="#initial-inherit"><span class=secno>4.1.1. </span> The
   179         &lsquo;<code class=css>initial</code>&rsquo; and &lsquo;<code
   180         class=css>inherit</code>&rsquo; keywords</a>
   181       </ul>
   183      <li><a href="#identifiers"><span class=secno>4.2. </span> User-defined
   184       Identifiers: the &lsquo;<code
   185       class=css>&lt;identifier&gt;</code>&rsquo; type</a>
   187      <li><a href="#strings"><span class=secno>4.3. </span> Quoted Strings:
   188       the &lsquo;<code class=css>&lt;string&gt;</code>&rsquo; type</a>
   190      <li><a href="#urls"><span class=secno>4.4. </span> Resource Locators:
   191       the &lsquo;<code class=css>&lt;url&gt;</code>&rsquo; type</a>
   192     </ul>
   194    <li><a href="#numeric-types"><span class=secno>5. </span> Numeric Data
   195     Types</a>
   196     <ul class=toc>
   197      <li><a href="#integers"><span class=secno>5.1. </span> Integers: the
   198       &lsquo;<code class=css>&lt;integer&gt;</code>&rsquo; type</a>
   200      <li><a href="#numbers"><span class=secno>5.2. </span> Numbers: the
   201       &lsquo;<code class=css>&lt;number&gt;</code>&rsquo; type</a>
   203      <li><a href="#percentages"><span class=secno>5.3. </span> Percentages:
   204       the &lsquo;<code class=css>&lt;percentage&gt;</code>&rsquo; type</a>
   205     </ul>
   207    <li><a href="#lengths"><span class=secno>6. </span> Distance Units: the
   208     &lsquo;<code class=css>&lt;length&gt;</code>&rsquo; type</a>
   209     <ul class=toc>
   210      <li><a href="#relative-lengths"><span class=secno>6.1. </span> Relative
   211       lengths</a>
   212       <ul class=toc>
   213        <li><a href="#font-relative-lengths"><span class=secno>6.1.1. </span>
   214         Font-relative lengths: the &lsquo;<code class=css>em</code>&rsquo;,
   215         &lsquo;<code class=css>ex</code>&rsquo;, &lsquo;<code
   216         class=css>ch</code>&rsquo;, &lsquo;<code class=css>rem</code>&rsquo;
   217         units</a>
   219        <li><a href="#viewport-relative-lengths"><span class=secno>6.1.2.
   220         </span> Viewport-relative lengths: the &lsquo;<code
   221         class=css>vw</code>&rsquo;, &lsquo;<code class=css>vh</code>&rsquo;,
   222         &lsquo;<code class=css>vm</code>&rsquo; units</a>
   223       </ul>
   225      <li><a href="#absolute-lengths"><span class=secno>6.2. </span> Absolute
   226       lengths: the &lsquo;<code class=css>cm</code>&rsquo;, &lsquo;<code
   227       class=css>mm</code>&rsquo;, &lsquo;<code class=css>in</code>&rsquo;,
   228       &lsquo;<code class=css>pt</code>&rsquo;, &lsquo;<code
   229       class=css>pc</code>&rsquo;, &lsquo;<code class=css>px</code>&rsquo;
   230       units </a>
   231     </ul>
   233    <li><a href="#other-units"><span class=secno>7. </span> Other Units</a>
   234     <ul class=toc>
   235      <li><a href="#angles"><span class=secno>7.1. </span> Angles: the
   236       &lsquo;<code class=css>&lt;angle&gt;</code>&rsquo; type and
   237       &lsquo;<code class=css>deg</code>&rsquo;, &lsquo;<code
   238       class=css>grad</code>&rsquo;, &lsquo;<code class=css>rad</code>&rsquo;,
   239       &lsquo;<code class=css>turn</code>&rsquo; units</a>
   241      <li><a href="#time"><span class=secno>7.2. </span> Times: the
   242       &lsquo;<code class=css>&lt;time&gt;</code>&rsquo; type and &lsquo;<code
   243       class=css>s</code>&rsquo;, &lsquo;<code class=css>ms</code>&rsquo;
   244       units</a>
   246      <li><a href="#frequencies-the-ltfrequencygt-type-and-h"><span
   247       class=secno>7.3. </span>Frequencies: the &lsquo;<code
   248       class=css>&lt;frequency&gt;</code>&rsquo; type and &lsquo;<code
   249       class=css>Hz</code>&rsquo;, &lsquo;<code class=css>kHz</code>&rsquo;
   250       units</a>
   251       <ul class=toc>
   252        <li><a href="#the-calc-min-and-max-functions"><span class=secno>7.3.1.
   253         </span>The &lsquo;<code class=property>calc</code>&rsquo;,
   254         &lsquo;<code class=property>min</code>&rsquo; and &lsquo;<code
   255         class=property>max</code>&rsquo; functions</a>
   256       </ul>
   258      <li><a href="#ltcolorgt"><span class=secno>7.4. </span>&lt;color&gt;</a>
   261      <li><a href="#ltattrgt"><span class=secno>7.5. </span>&lt;attr&gt;</a>
   263      <li><a href="#ltimagegt"><span class=secno>7.6. </span>&lt;image&gt;</a>
   266      <li><a href="#ltfractiongt"><span class=secno>7.7.
   267       </span>&lt;fraction&gt;</a>
   268       <ul class=toc>
   269        <li><a href="#the-fr-unit"><span class=secno>7.7.1. </span>The
   270         &lsquo;<code class=property>fr</code>&rsquo; unit</a>
   271       </ul>
   273      <li><a href="#ltgridgt"><span class=secno>7.8. </span>&lt;grid&gt;</a>
   274       <ul class=toc>
   275        <li><a href="#the-gr-unit"><span class=secno>7.8.1. </span>The
   276         &lsquo;<code class=property>gr</code>&rsquo; unit</a>
   277       </ul>
   278     </ul>
   280    <li><a href="#specified-computed-used-and-actual-value"><span
   281     class=secno>8. </span>Specified, computed, used, and actual values</a>
   282     <ul class=toc>
   283      <li><a href="#finding-the-specified-value"><span class=secno>8.1.
   284       </span>Finding the specified value</a>
   286      <li><a href="#finding-the-computed-value"><span class=secno>8.2.
   287       </span>Finding the computed value</a>
   289      <li><a href="#finding-the-used-value"><span class=secno>8.3.
   290       </span>Finding the used value</a>
   292      <li><a href="#finding-the-actual-value"><span class=secno>8.4.
   293       </span>Finding the actual value</a>
   294     </ul>
   296    <li class=no-num><a href="#acknowledgments">Acknowledgments</a>
   298    <li class=no-num><a href="#references">References</a>
   299     <ul class=toc>
   300      <li class=no-num><a href="#normative-references">Normative
   301       references</a>
   303      <li class=no-num><a href="#other-references">Other references</a>
   304     </ul>
   306    <li class=no-num><a href="#index">Index</a>
   307   </ul>
   308   <!--end-toc-->
   310   <h2 id=introduction><span class=secno>1. </span>Introduction</h2>
   312   <p>The value definition field of each CSS property can contain keywords,
   313    data types (which appear between &lsquo;<code class=css><</code>&rsquo;
   314    and &lsquo;<code class=css>></code>&rsquo;), and information on how they
   315    can be combined. Generic data types (<a
   316    href="#length-value"><code>&lt;length&gt;</code></a> being the most widely
   317    used) that can be used by many properties are described in this
   318    specification, while more specific data types (e.g.,
   319    <code>&lt;border-width&gt;</code>) are described in the corresponding
   320    modules. </code>
   322   <h3 id=placement><span class=secno>1.1. </span> Module Interactions</h3>
   324   <p>This module replaces and extends the data type definitions in <a
   325    href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> sections <a
   326    href="http://www.w3.org/TR/CSS21/about.html#value-defs">1.4.2.1</a>, <a
   327    href="http://www.w3.org/TR/CSS21/syndata.html#values">4.3</a>, and <a
   328    href="http://www.w3.org/TR/CSS21/aural.html#aural-intro">A.2</a>.
   330   <h2 id=value-defs><span class=secno>2. </span> Value Definition Syntax</h2>
   332   <p>The syntax described here is used to define the set of valid values for
   333    CSS properties. A property value can have one or more components.
   335   <h3 id=component-types><span class=secno>2.1. </span> Component value types</h3>
   337   <p>Component value types are designated in several ways:
   339   <ol>
   340    <li><a href="#keyword">keyword</a> values (such as &lsquo;<code
   341     class=css>auto</code>&rsquo;, &lsquo;<code class=css>disc</code>&rsquo;,
   342     etc.), which appear literally, without quotes (e.g. <code>auto</code>)
   344    <li>basic data types, which appear between &lsquo;<code
   345     class=css>&lt;</code>&rsquo; and &lsquo;<code
   346     class=css>&gt;</code>&rsquo; (e.g., <a
   347     href="#length-value"><code>&lt;length&gt;</code></a>, <a
   348     href="#percentage-value"><code>&lt;percentage&gt;</code></a>, etc.).
   350    <li>types that have the same range of values as a property bearing the
   351     same name (e.g., <code>&lt;'border-width'&gt;</code>
   352     <code>&lt;'background-attachment'&gt;</code>, etc.). In this case, the
   353     type name is the property name (complete with quotes) between the
   354     brackets. Such a type does <em>not</em> include the value &lsquo;<code
   355     class=property>inherit</code>&rsquo;.
   357    <li>non-terminals that do not share the same name as a property. In this
   358     case, the non-terminal name appears between &lsquo;<code
   359     class=css>&lt;</code>&rsquo; and &lsquo;<code
   360     class=css>&gt;</code>&rsquo;, as in <code>&lt;spacing&gt;</code>. Notice
   361     the distinction between <code>&lt;border-width&gt;</code> and
   362     <code>&lt;'border-width'&gt;</code>: the latter is defined as the value
   363     of the &lsquo;<code class=property>border-width</code>&rsquo; property,
   364     the former requires an explicit expansion elsewhere. The definition of a
   365     non-terminal is located near its first appearance in the specification.
   366   </ol>
   368   <p>Some property value definitions also include the slash (/) and/or the
   369    comma (,) as literals. These represent their corresponding tokens.
   371   <p>All CSS properties also accept the keyword values &lsquo;<code
   372    class=css>inherit</code>&rsquo; and &lsquo;<code
   373    class=css>initial</code>&rsquo; as their property value, but for
   374    readability these are not listed explicitly in the property value syntax
   375    definitions. These keywords cannot be combined with other component values
   376    in same declaration; such a declaration is invalid. For example,
   377    &lsquo;<code class=css>background: url(corner.png) no-repeat,
   378    inherit;</code>&rsquo; is invalid.
   380   <h3 id=component-combinators><span class=secno>2.2. </span> Component value
   381    combinators</h3>
   383   <p>Component values can be arranged into property values as follows:
   385   <ul>
   386    <li>Several juxtaposed words mean that all of them must occur, in the
   387     given order.
   389    <li>A double ampersand (&&) separates two or more components, all of which
   390     must occur, in any order.
   392    <li>A double bar (||) separates two or more options: one or more of them
   393     must occur, in any order.
   395    <li>A bar (|) separates two or more alternatives: exactly one of them must
   396     occur.
   398    <li>Brackets ([&nbsp;]) are for grouping.
   399   </ul>
   401   <p>Juxtaposition is stronger than the double ampersand, the double
   402    ampersand is stronger than the double bar, and the double bar is stronger
   403    than the bar. Thus, the following lines are equivalent:
   405   <pre>
   406 <!---->  a b   |   c ||   d &&   e f
   407 <!---->[ a b ] | [ c || [ d && [ e f ]]]</pre>
   409   <h3 id=component-multipliers><span class=secno>2.3. </span> Component value
   410    multipliers</h3>
   412   <p>Every type, keyword, or bracketed group may be followed by one of the
   413    following modifiers:
   415   <ul>
   416    <li>An asterisk (*) indicates that the preceding type, word, or group
   417     occurs zero or more times.
   419    <li>A plus (+) indicates that the preceding type, word, or group occurs
   420     one or more times.
   422    <li>A question mark (?) indicates that the preceding type, word, or group
   423     is optional.
   425    <li>A pair of numbers in curly braces ({<var>A</var>,<var>B</var>})
   426     indicates that the preceding type, word, or group occurs at least
   427     <var>A</var> and at most <var>B</var> times.
   429    <li>A hash mark (#) indicates that the preceding type, word, or group
   430     occurs one or more times, separated by comma tokens.
   431   </ul>
   433   <h3 id=component-whitespace><span class=secno>2.4. </span> Component values
   434    and white space</h3>
   436   <p>Component values are specified in terms of tokens, as described in <a
   437    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">Chapter 4</a>
   438    of <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. As the
   439    grammar allows spaces between tokens in the components of the
   440    <code>value</code> production, spaces may appear between tokens in
   441    property values.
   443   <p class=note>Note: In many cases, spaces will in fact be <em>required</em>
   444    between tokens in order to distinguish them from each other. For example,
   445    the value &lsquo;<code class=css>1em2em</code>&rsquo; would be parsed as a
   446    single <code>DIMEN</code> token with the number &lsquo;<code
   447    class=css>1</code>&rsquo; and the identifier &lsquo;<code
   448    class=css>em2em</code>&rsquo;, which is an invalid unit. In this case, a
   449    space would be required before the &lsquo;<code class=css>2</code>&rsquo;
   450    to get this parsed as the two lengths &lsquo;<code
   451    class=css>1em</code>&rsquo; and &lsquo;<code class=css>2em</code>&rsquo;.
   453   <h3 id=value-examples><span class=secno>2.5. </span> Property value
   454    examples</h3>
   456   <p>Below are some examples of properties with their corresponding value
   457    definition fields
   459   <div class=example>
   460    <table class=data id=propvalues>
   461     <thead>
   462      <tr>
   463       <th>Property
   465       <th>Value definition field
   467       <th>Example value
   469     <tbody>
   470      <tr>
   471       <td>&lsquo;<code class=property>orphans</code>&rsquo;
   473       <td>&lt;integer&gt;
   475       <td>&lsquo;<code class=css>3</code>&rsquo;
   477      <tr>
   478       <td>&lsquo;<code class=property>text-align</code>&rsquo;
   480       <td>left | right | center | justify
   482       <td>&lsquo;<code class=css>center</code>&rsquo;
   484      <tr>
   485       <td>&lsquo;<code class=property>padding-top</code>&rsquo;
   487       <td>&lt;length&gt; | &lt;percentage&gt;
   489       <td>&lsquo;<code class=css>5%</code>&rsquo;
   491      <tr>
   492       <td>&lsquo;<code class=property>outline-color</code>&rsquo;
   494       <td>&lt;color&gt; | invert
   496       <td>&lsquo;<code class=css>#fefefe</code>&rsquo;
   498      <tr>
   499       <td>&lsquo;<code class=property>text-decoration</code>&rsquo;
   501       <td>none | underline || overline || line-through || blink
   503       <td>&lsquo;<code class=css>overline underline</code>&rsquo;
   505      <tr>
   506       <td>&lsquo;<code class=property>font-family</code>&rsquo;
   508       <td>&lt;family-name&gt;#
   510       <td>&lsquo;<code class=css>"Gill Sans", Futura,
   511        sans-serif</code>&rsquo;
   513      <tr>
   514       <td>&lsquo;<code class=property>border-width</code>&rsquo;
   516       <td>[ &lt;length&gt; | thick | medium | thin ]{1,4}
   518       <td>&lsquo;<code class=css>2px medium 4px</code>&rsquo;
   520      <tr>
   521       <td>&lsquo;<code class=property>text-shadow</code>&rsquo;
   523       <td>[ inset? && [ &lt;length&gt;{2,4} && &lt;color&gt;? ] ]# | none
   525       <td>&lsquo;<code class=css>3px 3px rgba(50%, 50%, 50%, 50%),
   526        lemonchiffon 0 0 4px inset</code>&rsquo;
   528      <tr>
   529       <td>&lsquo;<code class=property>voice-pitch</code>&rsquo;
   531       <td>
   532        <pre class=value>&lt;frequency> && absolute |
   533 <!--				      -->[[x-low | low | medium | high | x-high] ||
   534 <!--				      --> [&lt;frequency> | &lt;semitones> | &lt;percentage>]]</pre>
   536       <td>&lsquo;<code class=css>-2st x-low</code>&rsquo;
   537    </table>
   538   </div>
   540   <h2 id=syntax-and-terminology><span class=secno>3. </span>Syntax and
   541    terminology</h2>
   543   <p>The generic data types described in the next sections use some common
   544    syntactic building blocks and terms that are described in this section.
   546   <h3 id=functional-notation><span class=secno>3.1. </span>Functional
   547    notation</h3>
   549   <p>Some values use a <dfn id=functional-notation0>functional notation</dfn>
   550    to type values and to and lump values together. The syntax starts with the
   551    name of the function followed by a left parenthesis followed by optional
   552    whitespace followed by the argument(s) to the functions followed by
   553    optional whitespace followed by a right parenthesis. If a function takes
   554    more than one argument, the arguments are separated by a comma
   555    (&lsquo;<code class=css>,</code>&rsquo;) with optional whitespace before
   556    and after the comma.
   558   <div class=example> background: url(http://www.example.org/image); color:
   559    rgb(100, 200, 50 );</div>
   561   <p>Some properties accept space- or comma-separated lists of values. A
   562    value that is composed of several values with spaces or commas between
   563    them, is called a <dfn id=compound-value>compound value</dfn>. A value
   564    that is not a compound value is a <dfn id=simple-value>simple value</dfn>.
   567   <h2 id=textual-values><span class=secno>4. </span> Textual Data Types</h2>
   569   <p>An <dfn id=identifier>identifier</dfn> is a sequence of characters
   570    conforming to the <code>IDENT</code> token in the <a
   571    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   572    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Identifiers
   573    cannot be quoted; otherwise they would be interpreted as a string.
   575   <h3 id=keywords><span class=secno>4.1. </span> Pre-defined Keywords</h3>
   577   <p>In the value definition fields, keywords with a pre-defined meaning
   578    appear literally. Keywords are CSS <i>identifiers</i> and are interpreted
   579    case-insensitively within the ASCII range (i.e., [a-z] and [A-Z] are
   580    equivalent).
   582   <div class=example>
   583    <p>For example, here is the value definition for the &lsquo;<code
   584     class=property>border-collapse</code>&rsquo; property:</p>
   586    <pre>Value:&nbsp;collapse | separate</pre>
   588    <p>And here is an example of its use:</p>
   590    <pre>table { border-collapse: separate }</pre>
   591   </div>
   593   <h4 id=initial-inherit><span class=secno>4.1.1. </span> The &lsquo;<code
   594    class=css>initial</code>&rsquo; and &lsquo;<code
   595    class=css>inherit</code>&rsquo; keywords</h4>
   597   <p>As defined <a href="#component-types">above</a>, all properties accept
   598    the &lsquo;<code class=css>initial</code>&rsquo; and &lsquo;<code
   599    class=css>inherit</code>&rsquo; keywords, which represent value concepts
   600    common to all CSS properties.
   602   <p>The <dfn id=inherit>&lsquo;<code class=css>inherit</code>&rsquo;</dfn>
   603    keyword is <a
   604    href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">defined</a>
   605    in <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
   607   <p>The <dfn id=initial>&lsquo;<code class=css>initial</code>&rsquo;</dfn>
   608    keyword represents the value that is designated as the property's initial
   609    value. <a href="#CSS3CASCADE"
   610    rel=biblioentry>[CSS3CASCADE]<!--{{CSS3CASCADE}}--></a>
   612   <p class=issue>Should these keywords affect the specified or computed
   613    value? See <a
   614    href="http://lists.w3.org/Archives/Public/www-style/2011Jan/0075.html">various</a>
   615    <a
   616    href="http://lists.w3.org/Archives/Public/www-style/2011May/0402.html">issues</a>.
   619   <p class=issue>Would it be useful to have a &lsquo;<code
   620    class=property>default</code>&rsquo; value, defined to be equivalent to <a
   621    class=css href="#inherit">&lsquo;<code
   622    class=property>inherit</code>&rsquo;</a> for properties that are inherited
   623    by default and equivalent to <a class=css href="#initial">&lsquo;<code
   624    class=property>initial</code>&rsquo;</a> for properties that are not
   625    inherited by default? This might be easier for authors to use than <a
   626    class=css href="#initial">&lsquo;<code
   627    class=property>initial</code>&rsquo;</a> and <a class=css
   628    href="#inherit">&lsquo;<code class=property>inherit</code>&rsquo;</a>
   629    since it wouldn't require thinking about whether a property is inherited
   630    by default or not (which isn't obvious for some properties, such as
   631    text-decoration and visibility).
   633   <h3 id=identifiers><span class=secno>4.2. </span> User-defined Identifiers:
   634    the &lsquo;<a href="#identifier-value"><code
   635    class=css>&lt;identifier&gt;</code></a>&rsquo; type</h3>
   637   <p>Some properties accept arbitrary user-defined identifiers as a component
   638    value. This generic data type is denoted by <dfn
   639    id=identifier-value><code>&lt;identifier&gt;</code></dfn>, and represents
   640    any valid CSS <a href="#identifier"><i>identifier</i></a> that does not
   641    otherwise appear as a pre-defined keyword in that property's value
   642    definition. Such identifiers are fully case-sensitive, even in the ASCII
   643    range (e.g. &lsquo;<code class=css>example</code>&rsquo; and &lsquo;<code
   644    class=css>EXAMPLE</code>&rsquo; are two different, unrelated user-defined
   645    identifiers).
   647   <h3 id=strings><span class=secno>4.3. </span> Quoted Strings: the &lsquo;<a
   648    href="#string-value"><code class=css>&lt;string&gt;</code></a>&rsquo; type</h3>
   650   <p>Strings are denoted by <dfn
   651    id=string-value><code>&lt;string&gt;</code></dfn> and consist of a
   652    sequence of characters delimited by double quotes or single quotes. They
   653    correspond to the <code>STRING</code> token in the <a
   654    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   655    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
   657   <div class=example>
   658    <p>Double quotes cannot occur inside double quotes, unless escaped (as
   659     &lsquo;<code class=css>\"</code>&rsquo; or as &lsquo;<code
   660     class=css>\22</code>&rsquo;). Analogously for single quotes
   661     ("\&lsquo;<code class=css>" or "\27"). </code>
   663    <pre>
   664 <!-- -->content: "this is a &rsquo;string'.";
   665 <!-- -->content: "this is a \"string\".";
   666 <!-- -->content: &lsquo;<code class=css>this is a "string".</code>&rsquo;;
   667 <!-- -->content: &lsquo;<code class=css>this is a \</code>&rsquo;string\&lsquo;<code class=css>.</code>&rsquo;;</pre>
   668   </div>
   670   <p>It is possible to break strings over several lines, for aesthetic or
   671    other reasons, but in such a case the newline itself has to be escaped
   672    with a backslash (\). The newline is subsequently removed from the string.
   673    For instance, the following two selectors are exactly the same:
   675   <div class=example>
   676    <p style="display:none">Example(s):</p>
   678    <pre>
   679 <!-- -->a[title="a not s\
   680 <!-- -->o very long title"] {/*...*/}
   681 <!-- -->a[title="a not so very long title"] {/*...*/}</pre>
   682   </div>
   684   <p>Since a string cannot directly represent a newline, to include a newline
   685    in a string, use the escape "\A". (Hexadecimal A is the line feed
   686    character in Unicode (U+000A), but represents the generic notion of
   687    "newline" in CSS.)
   689   <h3 id=urls><span class=secno>4.4. </span> Resource Locators: the &lsquo;<a
   690    href="#url-value"><code class=css>&lt;url&gt;</code></a>&rsquo; type</h3>
   692   <p>A <dfn id=url>URL</dfn> is a pointer to a resource and is a <a
   693    href="http://www.w3.org/TR/CSS21/syndata.html#uri">specially-parsed</a> <a
   694    href="#functional-notation">functional notation</a> denoted by <dfn
   695    id=url-value><code>&lt;url&gt;</code></dfn>. It corresponds to the
   696    <code>URI</code> token in the <a
   697    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   698    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
   700   <div class=example>
   701    <p>Below is an example of a URL being used as a background image:
   703    <pre>body { background: url("http://www.example.com/pinkish.gif") }</pre>
   705    <p>The same example can be written without quotes:
   707    <pre>body { background: url(http://www.example.com/pinkish.gif) }</pre>
   708   </div>
   710   <p class=note>Note that in some CSS syntactic contexts (as defined by that
   711    context), a URL can be represented as a <a
   712    href="#string-value"><code>&lt;string&gt;</code></a> rather than by <a
   713    href="#url-value"><code>&lt;URL&gt;</code></a>. An example of this is the
   714    <a href="http://www.w3.org/TR/CSS21/cascade.html#at-import">&lsquo;<code
   715    class=css>@import</code>&rsquo; rule</a>.
   717   <p>Parentheses, whitespace characters, single quotes (&apos;) and double
   718    quotes (") appearing in a URL must be escaped with a backslash so that the
   719    resulting value is a valid <a href="#url"><code>URL</code></a> token, e.g.
   720    &lsquo;<code class=css>url(open\(parens)</code>&rsquo;, &lsquo;<code
   721    class=css>url(close\)parens)</code>&rsquo;. Depending on the type of URL,
   722    it might also be possible to write these characters as URI-escapes (where
   723    <code>(</code> = <code>%28</code>, <code>)</code> = <code>%29</code>,
   724    etc.) as described in <a href="#URI"
   725    rel=biblioentry>[URI]<!--{{URI}}--></a>. Alternatively a URL containing
   726    such characters may be represented as a quoted <a
   727    href="#string">string</a> within the &lsquo;<a href="#url"><code
   728    class=css>url()</code></a>&rsquo; notation.
   730   <p>In order to create modular style sheets that are not dependent on the
   731    absolute location of a resource, authors should use relative URIs.
   732    Relative URIs (as defined in [[RFC3986]]) are resolved to full URIs using
   733    a base URI. RFC&nbsp;3986, section&nbsp;3, defines the normative algorithm
   734    for this process. For CSS style sheets, the base URI is that of the style
   735    sheet, not that of the source document.
   737   <div class=example>
   738    <p>For example, suppose the following rule:
   740    <pre>body { background: url("tile.png") }</pre>
   742    <p>is located in a style sheet designated by the URL:</p>
   744    <pre>http://www.example.org/style/basic.css</pre>
   746    <p>The background of the source document's <code>&lt;body&gt;</code> will
   747     be tiled with whatever image is described by the resource designated by
   748     the URL:
   750    <pre>http://www.example.org/style/tile.png</pre>
   752    <p>The same image will be used regardless of the URL of the source
   753     document containing the <code>&lt;body&lt;</code>.
   754   </div>
   756   <h2 id=numeric-types><span class=secno>5. </span> Numeric Data Types</h2>
   758   <h3 id=integers><span class=secno>5.1. </span> Integers: the &lsquo;<a
   759    href="#integer-value"><code class=css>&lt;integer&gt;</code></a>&rsquo;
   760    type</h3>
   762   <p>Integer values are denoted by <dfn
   763    id=integer-value><code>&lt;integer&gt;</code></dfn>. An <dfn
   764    id=integer>integer</dfn> is one or more decimal digits &lsquo;<code
   765    class=css>0</code>&rsquo; through &lsquo;<code class=css>9</code>&rsquo;
   766    and corresponds to a subset of the <a
   767    href="#number"><code>NUMBER</code></a> token in the <a
   768    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   769    Integers may be immediately preceded by &lsquo;<code
   770    class=css>-</code>&rsquo; or &lsquo;<code class=css>+</code>&rsquo; to
   771    indicate the sign.
   773   <p>Properties may restrict the integer value to some range. If the value is
   774    outside the allowed range, the declaration is invalid and must be <a
   775    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   777   <h3 id=numbers><span class=secno>5.2. </span> Numbers: the &lsquo;<a
   778    href="#number-value"><code class=css>&lt;number&gt;</code></a>&rsquo; type</h3>
   780   <p>Number values are denoted by <dfn
   781    id=number-value><code>&lt;number&gt;</code></dfn>. A <dfn
   782    id=number>number</dfn> is either an <a href="#integer"><i>integer</i></a>,
   783    or zero or more decimal digits followed by a dot (.) followed by one or
   784    more decimal digits. It corresponds to the <a
   785    href="#number"><code>NUMBER</code></a> token in the <a
   786    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   787    Like integers, numbers may also be immediately preceded by &lsquo;<code
   788    class=css>-</code>&rsquo; or &lsquo;<code class=css>+</code>&rsquo; to
   789    indicate the sign.
   791   <p>Properties may restrict the number value to some range. If the value is
   792    outside the allowed range, the declaration is invalid and must be <a
   793    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   795   <h3 id=percentages><span class=secno>5.3. </span> Percentages: the
   796    &lsquo;<a href="#percentage-value"><code
   797    class=css>&lt;percentage&gt;</code></a>&rsquo; type</h3>
   799   <p>A percentage value is denoted by <dfn
   800    id=percentage-value><code>&lt;percentage&gt;</code></dfn>, consists of a
   801    <a href="#number-value"><i>&lt;number&gt;</i></a> immediately followed by
   802    a percent sign &lsquo;<code class=css>%</code>&rsquo;. It corresponds to
   803    the <code>PERCENTAGE</code> token in the <a
   804    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   806   <p>Percentage values are always relative to another value, for example a
   807    length. Each property that allows percentages also defines the value to
   808    which the percentage refers. The value may be that of another property for
   809    the same element, a property for an ancestor element, or a value of the
   810    formatting context (e.g., the width of a <i>containing block</i>). When a
   811    percentage value is set for a property of the <i>root</i> element and the
   812    percentage is defined as referring to the inherited value of some
   813    property, the resultant value is the percentage times the <i>initial
   814    value</i> of that property.
   816   <p>Properties may restrict the percentage value to some range. If the value
   817    is outside the allowed range, the declaration is invalid and must be <a
   818    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   820   <h2 id=lengths><span class=secno>6. </span> Distance Units: the &lsquo;<a
   821    href="#length-value"><code class=css>&lt;length&gt;</code></a>&rsquo; type</h2>
   823   <p>Lengths refer to distance measurements and are denoted by <dfn
   824    id=length-value><code>&lt;length&gt;</code></dfn> in the property
   825    definitions. A length is a <a href="#dimension"><i>dimension</i></a>. A
   826    zero length may be represented instead as the <a
   827    href="#number-value"><code>&lt;number&gt;</code></a> &lsquo;<code
   828    class=css>0</code>&rsquo;. (In other words, for zero lengths the unit
   829    identifier is optional.)
   831   <p> A <dfn id=dimension>dimension</dfn> is a <a
   832    href="#number"><i>number</i></a> immediately followed by a unit
   833    identifier. It corresponds to the <a
   834    href="#dimension"><code>DIMENSION</code></a> token in the <a
   835    href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
   836    <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Like
   837    keywords, unit identifiers are case-insensitive within the ASCII range.
   839   <p>Properties may restrict the length value to some range. If the value is
   840    outside the allowed range, the declaration is invalid and must be <a
   841    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
   843   <p>While some properties allow negative length values, this may complicate
   844    the formatting and there may be implementation-specific limits. If a
   845    negative length value is allowed but cannot be supported, it must be
   846    converted to the nearest value that can be supported.
   848   <p>In cases where the <a href="#used-value">used</a> length cannot be
   849    supported, user agents must approximate it in the <a
   850    href="#actual-value">actual</a> value.
   852   <p>There are two types of length units: relative and absolute.
   854   <h3 id=relative-lengths><span class=secno>6.1. </span> Relative lengths</h3>
   856   <p><dfn id=relative-length-units title="relative length">Relative length
   857    units</dfn> specify a length relative to another length. Style sheets that
   858    use relative units can more easily scale from one output environment to
   859    another.
   861   <p>The relative units are:
   863   <table class=data>
   864    <caption>Informative Summary of Relative Units</caption>
   866    <thead>
   867     <tr>
   868      <th>unit
   870      <th>relative to
   872    <tbody>
   873     <tr>
   874      <td>&lsquo;<a href="#em-unit"><code class=css>em</code></a>&rsquo;
   876      <td>font size of the element
   878     <tr>
   879      <td>&lsquo;<a href="#ex-unit"><code class=css>ex</code></a>&rsquo;
   881      <td><i>x-height</i> of the element's font
   883     <tr>
   884      <td>&lsquo;<a href="#ch-unit"><code class=css>ch</code></a>&rsquo;
   886      <td>width of the "0" glyph in the element's font
   888     <tr>
   889      <td>&lsquo;<a href="#rem-unit"><code class=css>rem</code></a>&rsquo;
   891      <td>font size of the root element
   893     <tr>
   894      <td>&lsquo;<a href="#vw-unit"><code class=css>vw</code></a>&rsquo;
   896      <td>viewport's width
   898     <tr>
   899      <td>&lsquo;<a href="#vh-unit"><code class=css>vh</code></a>&rsquo;
   901      <td>viewport's height
   903     <tr>
   904      <td>&lsquo;<a href="#vm-unit"><code class=css>vm</code></a>&rsquo;
   906      <td>minimum of the viewport's height and width
   907   </table>
   909   <p>Child elements do not inherit the relative values as specified for their
   910    parent; they inherit the <a href="#computed-value">computed values</a>.
   912   <h4 id=font-relative-lengths><span class=secno>6.1.1. </span> Font-relative
   913    lengths: the &lsquo;<a href="#em-unit"><code
   914    class=css>em</code></a>&rsquo;, &lsquo;<a href="#ex-unit"><code
   915    class=css>ex</code></a>&rsquo;, &lsquo;<a href="#ch-unit"><code
   916    class=css>ch</code></a>&rsquo;, &lsquo;<a href="#rem-unit"><code
   917    class=css>rem</code></a>&rsquo; units</h4>
   919   <p>Aside from &lsquo;<a href="#rem-unit"><code
   920    class=css>rem</code></a>&rsquo; (which refers to the font-size of the root
   921    element), the font-relative lengths refer to the computed font metrics of
   922    the element on which they are used. The exception is when they occur in
   923    the value of the &lsquo;<code class=property>font-size</code>&rsquo;
   924    property itself, in which case they refer to the font metrics of the
   925    parent element (or the font metrics corresponding to the initial values of
   926    the &lsquo;<code class=property>font</code>&rsquo; property, if the
   927    element has no parent).
   929   <dl>
   930    <dt><dfn id=em-unit title=em>em unit</dfn>
   932    <dd>
   933     <p>Equal to the computed value of the &lsquo;<code
   934      class=property>font-size</code>&rsquo; property of the element on which
   935      it is used.
   937     <div class=example>
   938      <p>The rule:</p>
   940      <pre>h1 { line-height: 1.2em }</pre>
   942      <p>means that the line height of <code>h1</code> elements will be 20%
   943       greater than the font size of <code>h1</code> element. On the other
   944       hand:
   946      <pre>h1 { font-size: 1.2em }</pre>
   948      <p>means that the font size of <code>h1</code> elements will be 20%
   949       greater than the font size inherited by <code>h1</code> elements.</p>
   950     </div>
   952    <dt><dfn id=ex-unit title=ex>ex unit</dfn>
   954    <dd>
   955     <p>Equal to the font's x-height. The x-height is so called because it is
   956      often equal to the height of the lowercase "x". However, an &lsquo;<a
   957      href="#ex-unit"><code class=css>ex</code></a>&rsquo; is defined even for
   958      fonts that do not contain an "x".
   960     <p>The x-height of a font can be found in different ways. Some fonts
   961      contain reliable metrics for the x-height. If reliable font metrics are
   962      not available, UAs may determine the x-height from the height of a
   963      lowercase glyph. One possible heuristic is to look at how far the glyph
   964      for the lowercase "o" extends below the baseline, and subtract that
   965      value from the top of its bounding box. In the cases where it is
   966      impossible or impractical to determine the x-height, a value of 0.5em
   967      must be assumed.
   969    <dt><dfn id=ch-unit title=ch>ch unit</dfn>
   971    <dd>
   972     <p>Equal to the advance measure of the "0" (ZERO, U+0030) glyph found in
   973      the font used to render it.
   975    <dt><dfn id=rem-unit title=rem>rem unit</dfn>
   977    <dd>
   978     <p>Equal to the computed value of &lsquo;<code
   979      class=property>font-size</code>&rsquo; on the root element.
   981     <p>When specified on the &lsquo;<code
   982      class=property>font-size</code>&rsquo; property of the root element, the
   983      &lsquo;<a href="#rem-unit"><code class=css>rem</code></a>&rsquo; units
   984      refer to the property's <em>initial value</em>.</p>
   985   </dl>
   987   <h4 id=viewport-relative-lengths><span class=secno>6.1.2. </span>
   988    Viewport-relative lengths: the &lsquo;<a href="#vw-unit"><code
   989    class=css>vw</code></a>&rsquo;, &lsquo;<a href="#vh-unit"><code
   990    class=css>vh</code></a>&rsquo;, &lsquo;<a href="#vm-unit"><code
   991    class=css>vm</code></a>&rsquo; units</h4>
   993   <p>The viewport-relative lengths are relative to the size of the initial
   994    containing block. When the height or width of the viewport is changed,
   995    they are scaled proportionally.
   997   <dl>
   998    <dt><dfn id=vw-unit title=vw>vw unit</dfn>
  1000    <dd>Equal to 1/100th of the width of the initial containing block.
  1001     <div class=example>
  1002      <p>In the example below, if the width of the viewport is 200mm, the font
  1003       size of <code>h1</code> elements will be 16mm (i.e.
  1004       (8&times;200mm)/100).
  1006      <pre>h1 { font-size: 8vw }</pre>
  1007     </div>
  1009    <dt><dfn id=vh-unit title=vh>vh unit</dfn>
  1011    <dd>Equal to 1/100th of the height of the initial containing block.
  1013    <dt><dfn id=vm-unit title=vm>vm unit</dfn>
  1015    <dd>Equal to the smaller of &lsquo;<a href="#vw-unit"><code
  1016     class=css>vw</code></a>&rsquo; or &lsquo;<a href="#vh-unit"><code
  1017     class=css>vh</code></a>&rsquo;.
  1018     <p class=issue>Do we need this now that we have the min() function?
  1019   </dl>
  1021   <h3 id=absolute-lengths><span class=secno>6.2. </span> Absolute lengths:
  1022    the &lsquo;<code class=css>cm</code>&rsquo;, &lsquo;<code
  1023    class=css>mm</code>&rsquo;, &lsquo;<code class=css>in</code>&rsquo;,
  1024    &lsquo;<code class=css>pt</code>&rsquo;, &lsquo;<code
  1025    class=css>pc</code>&rsquo;, &lsquo;<code class=css>px</code>&rsquo; units</h3>
  1027   <p>The <dfn id=absolute-length-units>absolute length units</dfn> are fixed
  1028    in relation to each other and anchored to some physical measurement. They
  1029    are mainly useful when the output environment is known. The absolute units
  1030    consist of the physical units (in, cm, mm, pt, pc) and the px unit:
  1032   <table class=data>
  1033    <thead>
  1034     <tr>
  1035      <th>unit
  1037      <th>definition
  1039    <tbody>
  1040     <tr>
  1041      <td>&lsquo;<code class=css>cm</code>&rsquo;
  1043      <td>centimeters
  1045     <tr>
  1046      <td>&lsquo;<code class=css>mm</code>&rsquo;
  1048      <td>millimeters
  1050     <tr>
  1051      <td>&lsquo;<code class=css>in</code>&rsquo;
  1053      <td>inches; 1in is equal to 2.54cm
  1055     <tr>
  1056      <td>&lsquo;<code class=css>px</code>&rsquo;
  1058      <td>pixels; 1px is equal to 1/96th of 1in
  1060     <tr>
  1061      <td>&lsquo;<code class=css>pt</code>&rsquo;
  1063      <td>points; 1pt is equal to 1/72nd of 1in
  1065     <tr>
  1066      <td>&lsquo;<code class=css>pc</code>&rsquo;
  1068      <td>picas; 1pc is equal to 12pt
  1069   </table>
  1071   <pre class=example>
  1072 h1 { margin: 0.5in }      /* inches  */
  1073 h2 { line-height: 3cm }   /* centimeters */
  1074 h3 { word-spacing: 4mm }  /* millimeters */
  1075 h4 { font-size: 12pt }    /* points */
  1076 h4 { font-size: 1pc }     /* picas */
  1077 p  { font-size: 12px }    /* px */</pre>
  1079   <p>For a CSS device, these dimensions are either anchored (i) by relating
  1080    the physical units to their physical measurements, or (ii) by relating the
  1081    pixel unit to the <a href="#reference-pixel"><i>reference pixel</i></a>.
  1082    For print media and similar high-resolution devices, the anchor unit
  1083    should be one of the standard physical units (inches, centimeters, etc).
  1084    For lower-resolution devices, and devices with unusual viewing distances,
  1085    it is recommended instead that the anchor unit be the pixel unit. For such
  1086    devices it is recommended that the pixel unit refer to the whole number of
  1087    device pixels that best approximates the reference pixel.
  1089   <p class=note>Note that if the anchor unit is the pixel unit, the physical
  1090    units might not match their physical measurements. Alternatively if the
  1091    anchor unit is a physical unit, the pixel unit might not map to a whole
  1092    number of device pixels.
  1094   <p class=note>Note that this definition of the pixel unit and the physical
  1095    units differs from previous versions of CSS. In particular, in previous
  1096    versions of CSS the pixel unit and the physical units were not related by
  1097    a fixed ratio: the physical units were always tied to their physical
  1098    measurements while the pixel unit would vary to most closely match the
  1099    reference pixel. (This change was made because too much existing content
  1100    relies on the assumption of 96dpi, and breaking that assumption breaks the
  1101    content.)
  1103   <p>The <dfn id=reference-pixel>reference pixel</dfn> is the visual angle of
  1104    one pixel on a device with a pixel density of 96dpi and a distance from
  1105    the reader of an arm's length. For a nominal arm's length of 28 inches,
  1106    the visual angle is therefore about 0.0213 degrees. For reading at arm's
  1107    length, 1px thus corresponds to about 0.26&nbsp;mm (1/96&nbsp;inch).
  1109   <p>The image below illustrates the effect of viewing distance on the size
  1110    of a reference pixel: a reading distance of 71&nbsp;cm (28&nbsp;inches)
  1111    results in a reference pixel of 0.26&nbsp;mm, while a reading distance of
  1112    3.5&nbsp;m (12&nbsp;feet) results in a reference pixel of 1.3&nbsp;mm.
  1114   <div class=figure>
  1115    <p><img alt="This diagram illustrates how the definition of a pixel
  1116     depends on the users distance from the viewing surface (paper or screen).
  1117     The image depicts the user looking at two planes, one 28 inches (71 cm)
  1118     from the user, the second 140 inches (3.5 m) from the user. An expanding
  1119     cone is projected from the user's eye onto each plane. Where the cone
  1120     strikes the first plane, the projected pixel is 0.26 mm high. Where the
  1121     cone strikes the second plane, the projected pixel is 1.4 mm high."
  1122     src=pixel1.png>
  1124    <p class=caption>Showing that pixels must become larger if the viewing
  1125     distance increases
  1126   </div>
  1128   <p>This second image illustrates the effect of a device's resolution on the
  1129    pixel unit: an area of 1px by 1px is covered by a single dot in a
  1130    low-resolution device (e.g. a typical computer display), while the same
  1131    area is covered by 16 dots in a higher resolution device (such as a
  1132    printer).
  1134   <div class=figure>
  1135    <p><img alt="This diagram illustrates the relationship between the
  1136     reference pixel and device pixels (called &#34;dots&#34; below). The
  1137     image depicts a high resolution (large dot density) laser printer output
  1138     on the left and a low resolution monitor screen on the right. For the
  1139     laser printer, one square reference pixel is implemented by 16 dots. For
  1140     the monitor screen, one square reference pixel is implemented by a single
  1141     dot." src=pixel2.png>
  1143    <p class=caption>Showing that more device pixels (dots) are needed to
  1144     cover a 1px by 1px area on a high-resolution device than on a low-res one
  1146   </div>
  1148   <h2 id=other-units><span class=secno>7. </span> Other Units</h2>
  1150   <h3 id=angles><span class=secno>7.1. </span> Angles: the &lsquo;<a
  1151    href="#angle-value"><code class=css>&lt;angle&gt;</code></a>&rsquo; type
  1152    and &lsquo;<a href="#deg"><code class=css>deg</code></a>&rsquo;, &lsquo;<a
  1153    href="#grad"><code class=css>grad</code></a>&rsquo;, &lsquo;<a
  1154    href="#rad"><code class=css>rad</code></a>&rsquo;, &lsquo;<a
  1155    href="#turn"><code class=css>turn</code></a>&rsquo; units</h3>
  1157   <p>Angle values are <i>dimensions</i> denoted by <dfn
  1158    id=angle-value>&lt;angle&gt;</dfn>. The angle unit identifiers are:
  1160   <dl>
  1161    <dt><dfn id=deg title=deg>deg</dfn>
  1163    <dd>Degrees. There are 360 degrees in a full circle.
  1165    <dt><dfn id=grad title=grad>grad</dfn>
  1167    <dd>Gradians. There are 400 gradians in a full circle.
  1169    <dt><dfn id=rad title=rad>rad</dfn>
  1171    <dd>Radians. There are 2&pi; radians in a full circle. <span
  1172     class=issue>Who is going to use this anyway?</span>
  1174    <dt><dfn id=turn title=turn>turn</dfn>
  1176    <dd>Turns. There is 1 turn in a full circle.
  1177   </dl>
  1179   <p>For example, a right angle is &lsquo;<code class=css>90deg</code>&rsquo;
  1180    or &lsquo;<code class=css>100grad</code>&rsquo; or &lsquo;<code
  1181    class=css>0.25turn</code>&rsquo; or approximately &lsquo;<code
  1182    class=css>1.570796326794897rad</code>&rsquo;.
  1184   <h3 id=time><span class=secno>7.2. </span> Times: the &lsquo;<a
  1185    href="#time-value"><code class=css>&lt;time&gt;</code></a>&rsquo; type and
  1186    &lsquo;<a href="#s"><code class=css>s</code></a>&rsquo;, &lsquo;<a
  1187    href="#ms"><code class=css>ms</code></a>&rsquo; units</h3>
  1189   <p>Time values are <i>dimensions</i> denoted by <dfn
  1190    id=time-value>&lt;time&gt;</dfn>. The time unit identifiers are:
  1192   <dl>
  1193    <dt><dfn id=s title=s>s</dfn>
  1195    <dd>Seconds.
  1197    <dt><dfn id=ms title=ms>ms</dfn>
  1199    <dd>Milliseconds. There are 1000 milliseconds in a second.
  1200   </dl>
  1202   <p>Properties may restrict the time value to some range. If the value is
  1203    outside the allowed range, the declaration is invalid and must be <a
  1204    href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
  1206   <h3 id=frequencies-the-ltfrequencygt-type-and-h><span class=secno>7.3.
  1207    </span>Frequencies: the &lsquo;<a href="#frequency-value"><code
  1208    class=css>&lt;frequency&gt;</code></a>&rsquo; type and &lsquo;<a
  1209    href="#hz"><code class=css>Hz</code></a>&rsquo;, &lsquo;<a
  1210    href="#khz"><code class=css>kHz</code></a>&rsquo; units</h3>
  1212   <p>Frequency values are <i>dimensions</i> denoted by <dfn
  1213    id=frequency-value>&lt;frequency&gt;</dfn>. The frequency unit identifiers
  1214    are:
  1216   <dl>
  1217    <dt><dfn id=hz title=Hz>Hz</dfn>
  1219    <dd>Hertz. It represents the number of occurrences per second.
  1221    <dt><dfn id=khz title=kHz>kHz</dfn>
  1223    <dd>KiloHertz. A kiloHertz is 1000 Hertz.
  1224     <p>For example, when representing sound pitches, 200Hz (or 200hz) is a
  1225      bass sound, and 6kHz (or 6khz) is a treble sound.</p>
  1227     <h4 id=the-calc-min-and-max-functions><span class=secno>7.3.1. </span>The
  1228      &lsquo;<a href="#calc"><code class=property>calc</code></a>&rsquo;,
  1229      &lsquo;<a href="#min"><code class=property>min</code></a>&rsquo; and
  1230      &lsquo;<a href="#max"><code class=property>max</code></a>&rsquo;
  1231      functions</h4>
  1233     <p>The <dfn id=calc>calc()</dfn>, <dfn id=min>min()</dfn>, and <dfn
  1234      id=max>max()</dfn> functions can be used wherever length, frequency,
  1235      angle, time, or number values are allowed.
  1237     <div class=example>
  1238      <pre>
  1239 section {
  1240   float: left;
  1241   margin: 1em; border: solid 1px;
  1242   width: calc(100%/3 - 2*1em - 2*1px);
  1244 </pre>
  1245     </div>
  1247     <div class=example>
  1248      <pre>
  1249 p {
  1250   margin: calc(1rem - 2px) calc(1rem - 1px);
  1252 </pre>
  1253     </div>
  1255     <div class=example>
  1256      <pre>
  1257 p { font-size: min(10px, 3em) }
  1258 blockquote { font-size: max(30px, 3em) }
  1259 </pre>
  1260     </div>
  1262     <div class=example>
  1263      <pre>
  1264 .box { width: min(10% + 20px, 300px) }
  1265 </pre>
  1266     </div>
  1268     <p>The expression language of these functions is described by the grammar
  1269      and prose below.
  1271     <pre>
  1272 S       : calc | min | max;
  1273 calc    : "calc(" S* sum ")" S*;
  1274 min     : "min(" S* sum [ "," S* sum ]* ")" S*;
  1275 max     : "max(" S* sum [ "," S* sum ]* ")" S*;
  1276 sum     : product [ [ "+" | "-" ] S* product ]*;
  1277 product : unit [ [ "*" | "/" | "mod" ] S* unit ]*;
  1278 unit    : ["+"|"-"]? [ NUMBER S* | DIMENSION S* | PERCENTAGE S* |
  1279           min | max | "(" S* sum ")" S* ];
  1280 </pre>
  1282     <p>The context of the expression imposes a target type, which is one of
  1283      length, frequency, angle, time, or number. NUMBER tokens are of type
  1284      number. DIMENSION tokens have types of their units (&lsquo;<code
  1285      class=property>cm</code>&rsquo; is length, &lsquo;<a href="#deg"><code
  1286      class=property>deg</code></a>&rsquo; is angle etc.); any DIMENSION whose
  1287      type does not match the target type is not allowed and must be a parse
  1288      error. If percentages are accepted in that context and convertible to
  1289      the target type, a PERCENTAGE token in the expression has the target
  1290      type; otherwise percentages are not allowed and must be a parse error.
  1292     <p>To make expressions simpler, operators have restrictions on the types
  1293      they accept. At each operator, the types of the left and right side have
  1294      to be checked for these restrictions. If compatible, they return roughly
  1295      as follows (the following ignores precedence rules on the operators for
  1296      simplicity):
  1298     <ol>
  1299      <li>At ",", "+", "-":<br>
  1300       check: both sides have the same type<br>
  1301       return: that type
  1303      <li>At "*":<br>
  1304       check: at least one side is "number" <br>
  1305       return: the type of the other side
  1307      <li>At "/":<br>
  1308       check: right side is "number"<br>
  1309       return: the type of the left side
  1310     </ol>
  1312     <p>Division by zero is a parse error.
  1314     <p>The value resulting from an expression must be clamped to the range
  1315      allowed in the target context.
  1317     <div class=example> These two are equivalentequivalent to &lsquo;<code
  1318      class=css>width: 0px</code>&rsquo; since widths smaller than 0px are not
  1319      allowed.
  1320      <pre>
  1321 width: calc(5px - 10px);
  1322 width: 0px;
  1323 </pre>
  1324     </div>
  1326     <p>Given the complexities of &lsquo;<code
  1327      class=property>width</code>&rsquo; and &lsquo;<code
  1328      class=property>height</code>&rsquo; on table cells and table elements,
  1329      calc() expressions for &lsquo;<code class=property>width</code>&rsquo;
  1330      and &lsquo;<code class=property>height</code>&rsquo; on table columns,
  1331      table column groups, table rows, table row groups, and table cells in
  1332      both auto and fixed layout tables are treated as if &lsquo;<code
  1333      class=property>auto</code>&rsquo; had been specified.
  1335     <h3 id=ltcolorgt><span class=secno>7.4. </span>&lt;color&gt;</h3>
  1337     <p><em>This section is not normative. The CSS3 Color module <a
  1338      href="#CSS3COLOR" rel=biblioentry>[CSS3COLOR]<!--{{!CSS3COLOR}}--></a>
  1339      defines the CSS3 color values.</em>
  1341     <p>Color values are denoted by <dfn id=ltcolorgt0>&lt;color&gt;</dfn> in
  1342      the value definitions.
  1344     <p>A <dfn id=color>color</dfn> value can either be a keyword, a numerical
  1345      specification in a functional notation, or a numerical RGB specification
  1346      in a hexadecimal notation. The hexadecimal notation is special shorthand
  1347      format that allows compact color descriptions.
  1349     <div class=example>
  1350      <pre>
  1351 em { color: #F00 }
  1352 span.issue { color: red }
  1353 * { color: hsl(120, 75%, 75%) } 
  1354 </pre>
  1355     </div>
  1357     <h3 id=ltattrgt><span class=secno>7.5. </span>&lt;attr&gt;</h3>
  1359     <p class=issue>Describe the feature fully here, not just a delta from CSS
  1360      21.
  1362     <p class=issue>When attr is set on a pseudo-element, it should apply to
  1363      the originating element
  1365     <p>In CSS2.1 <a href="#CSS21"
  1366      rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, the &lsquo;<code
  1367      class=css>attr()</code>&rsquo; expression always returns a string. In
  1368      CSS3, the &lsquo;<code class=css>attr()</code>&rsquo; expression can
  1369      return many different types. The new syntax for the attr() expression
  1370      is:
  1372     <pre>
  1373 'attr(' ident [ ',' &lt;type> [ ',' &lt;value> ]? ]? ')'
  1374 </pre>
  1376     <p>The first argument represents the attribute name. The value of the
  1377      attribute with that name on the element whose computed values are being
  1378      computed is used as the value of the expression, according to the rules
  1379      given below.
  1381     <p>The first argument accepts an optional namespace prefix to identify
  1382      the namespace of the attribute. The namespace prefix and the attribute
  1383      name is separated by &lsquo;<code class=css>|</code>&rsquo;, with no
  1384      whitespace before or after the separator <a href="#CSS3NAMESPACE"
  1385      rel=biblioentry>[CSS3NAMESPACE]<!--{{CSS3NAMESPACE}}--></a>.
  1387     <p>The second argument (which is optional but must be present if the
  1388      third argument is present) is a &lt;type> and tells the UA how to
  1389      interpret the attribute value. It may be one of the values from the list
  1390      below.
  1392     <p>The third argument (which is optional) is a CSS value which must be
  1393      valid where the attr() expression is placed. If it is not valid, then
  1394      the whole attr() expression is invalid.
  1396     <p>If the attribute named by the first argument is missing, cannot be
  1397      parsed, or is invalid for the property, then the value returned by
  1398      attr() will be the third argument, or, if the third argument is absent,
  1399      will be the value given as the default for the relevant type in the list
  1400      below.
  1402     <dl>
  1403      <dt>string
  1405      <dd>The attribute value will be interpreted as the contents of a CSS
  1406       string. The default is the empty string.
  1408      <dt>color
  1410      <dd>The attribute value will be interpreted as a CSS &lt;color> value.
  1411       The default is UA dependent but must be the same as the initial value
  1412       of the &lsquo;<a href="#color"><code
  1413       class=property>color</code></a>&rsquo; property.
  1415      <dt>url
  1417      <dd>The attribute value will be interpreted as the URI part of a
  1418       &lsquo;<a href="#url"><code class=css>url()</code></a>&rsquo;
  1419       expression. The default is a UA-dependent URI defined to point to a
  1420       non-existent document with a generic error condition. (i.e. it
  1421       shouldn't be an FTP URI that causes a DNS error, or an HTTP URI that
  1422       results in a 404, it should be a nondescript error condition.)
  1424      <dt>integer
  1426      <dd>The attribute value will be interpreted as a CSS integer. The
  1427       default is 0. The default should also be used if the property in
  1428       question only accepts integers within a certain range and the attribute
  1429       is out of range.
  1431      <dt>number
  1433      <dd>The attribute value will be interpreted as a CSS number. The default
  1434       is 0.0. The default should also be used if the property in question
  1435       only accepts numbers within a certain range and the attribute is out of
  1436       range.
  1438      <dt>length, angle, time, frequency
  1440      <dd>The attribute value will be interpreted as a CSS length, angle, time
  1441       or frequency (respectively), and the unit identifier (if any) will
  1442       appear in the attribute value. The default is 0. The default should
  1443       also be used if the property in question only accepts values within a
  1444       certain range (e.g. positive lengths or angles from 0 to 90deg) and the
  1445       attribute is out of range (e.g. a negative length or 180deg).
  1447      <dt>em, ex, px, gr, rem, vw, vh, vm, mm, cm, in, pt, pc, deg, grad, rad,
  1448       ms, s, Hz, kHz, %
  1450      <dd>The attribute value will be interpreted as a float, with the given
  1451       type suffixed as a unit. The default is 0 in the relevant units.
  1452     </dl>
  1454     <p class=issue>Should there also be a "keyword" type to, e.g., support
  1455      &lsquo;<code class=css>float: attr(align)</code>&rsquo;</p>
  1457     <p>If the &lt;type> is missing, &lsquo;<code
  1458      class=property>string</code>&rsquo; is implied.
  1460     <p class=issue>Ideally, it shouldn't be necessary to specify the type if
  1461      it is obvious. For example, this should be valid: "<tt>background-image:
  1462      attr(href);</tt>". This could be described as: <q>If the property only
  1463      accepts one type of value (aside from &lsquo;<code
  1464      class=property>inherit</code>&rsquo; and &lsquo;<code
  1465      class=property>initial</code>&rsquo;), that type is implied</q>.
  1467     <p>The attr() form is only valid if the type given (or implied, if it is
  1468      missing) is valid for the property. For example, all of the following
  1469      are invalid and would cause a parse-time error (and thus cause the
  1470      relevant declaration, in this case all of them, to be ignored):
  1472     <div class="illegal example">
  1473      <p style="display:none">Illegal Examples:
  1475      <pre>
  1476       content: attr(title, color); /* 'content' doesn't accept colors */
  1478       content: attr(end-of-quote, string, inherit) close-quote; /* the
  1479       'inherit' value is not allowed there, since the result would be
  1480       'inherit close-quote', which is invalid. */
  1482       margin: attr(vertical, length) attr(horizontal, deg); /* deg
  1483       units are not valid at that point */
  1484 <!--
  1485       font: attr(weight, integer) attr(size, length)/attr(height,
  1486       integer) attr(family, string); /* invalid because
  1487       &lt;'font-weight'>s are not integers, but identifiers. */
  1488 -->
  1489       color: attr(color); /* 'color' doesn't accept strings */
  1490 </pre>
  1491     </div>
  1493     <p>The attr() expression cannot return everything, for example it cannot
  1494      do counters, named strings, quotes, or values such as &lsquo;<code
  1495      class=property>auto</code>&rsquo;, &lsquo;<code
  1496      class=property>nowrap</code>&rsquo;, or &lsquo;<code
  1497      class=property>baseline</code>&rsquo;. This is intentional, as the
  1498      intent of the &lsquo;<code class=css>attr()</code>&rsquo; expression is
  1499      not to make it possible to describe a presentational language's
  1500      formatting using CSS, but to enable CSS to take semantic data into
  1501      account.
  1503     <p>Note that the default value need not be of the type given. For
  1504      instance, if the type required of the attribute by the author is
  1505      &lsquo;<code class=property>px</code>&rsquo;, the default could still be
  1506      &lsquo;<code class=css>5em</code>&rsquo;.
  1508     <div class=example>
  1509      <p>Examples:
  1511      <pre>
  1512       &lt;stock>
  1513         &lt;wood length="12"/>
  1514         &lt;wood length="5"/>
  1515         &lt;metal length="19"/>
  1516         &lt;wood length="4"/>
  1517       &lt;/stock>
  1519       stock::before {
  1520         display: block;
  1521         content: "To scale, the lengths of materials in stock are:";
  1523       stock > * {
  1524         display: block;
  1525         width: attr(length, em); /* default 0 */
  1526         height: 1em;
  1527         border: solid thin;
  1528         margin: 0.5em;
  1530       wood {
  1531         background: orange url(wood.png);
  1533       metal {
  1534         background: silver url(metal.png);
  1537       /* this also uses a possible extension to the 'content' property
  1538       to handle replaced content and alternatives to unavailable,
  1539       corrupted or unsupported content */
  1540       img {
  1541          content: replaced attr(src, url), attr(alt, string, none);
  1542          height: attr(height, px, auto);
  1543          width: attr(width, px, auto);
  1545 </pre>
  1546     </div>
  1548     <p>The attr() expression cannot currently fall back onto another
  1549      attribute. Future versions of CSS may extend attr() in this direction.
  1551     <p class=issue>Should &lsquo;<code class=css>attr()</code>&rsquo; be
  1552      allowed on any property, in any source language? For example, do we
  1553      expect UAs to honor this rule for HTML documents?: <tt>P[COLOR] { color:
  1554      attr(COLOR, color) }</tt>.
  1556     <h3 id=ltimagegt><span class=secno>7.6. </span>&lt;image&gt;</h3>
  1558     <p>TBD. <!--
  1559 <h4>The 'counter' function</h4>
  1561 <p><dfn title="&lt;counter&gt;, definition of">Counters</dfn> are denoted by
  1562 identifiers (see the <span class="property">'counter-increment'</span> and
  1563 <span class="property">'counter-reset'</span> properties). To refer to the
  1564 value of a counter, the notation <dfn>'counter(&lt;identifier&gt;)'</dfn> or
  1565 <dfn>'counter(&lt;identifier&gt;, &lt;list-style-type&gt;)'</dfn> is used.
  1566 The default style is 'decimal'.</p>
  1568 <p>To refer to a sequence of nested counters of the same name, the notation
  1569 is 'counters(&lt;identifier&gt;, &lt;string&gt;)' or
  1570 'counters(&lt;identifier&gt;, &lt;string&gt;, &lt;list-style-type&gt;)'. See
  1571 "Nested counters and scope" [add ref] in the chapter on generated content
  1572 [add ref].</p>
  1574 <p>In CSS2.1, the values of counters can only be referred to from the <span
  1575 class="property">'content'</span> property. Note that 'none' is a possible
  1576 &lt;list-style-type&gt;: 'counter(x, none)' yields an empty string.</p>
  1578 <div class="example">
  1579 <p style="display:none">Example(s):</p>
  1581 <p>Here is a style sheet that numbers paragraphs (P) for each chapter (H1).
  1582 The paragraphs are numbered with roman numerals, followed by a period and a
  1583 space:</p>
  1585 <pre>
  1586 p { counter-increment: par-num }
  1587 h1 { counter-reset: par-num }
  1588 p:before { content: counter(par-num, upper-roman) ". " }
  1589 </pre>
  1590 </div>
  1591 -->
  1594     <h3 id=ltfractiongt><span class=secno>7.7. </span>&lt;fraction&gt;</h3>
  1596     <p>Some properties accept a series of length values that, in sum, should
  1597      add up to a certain length. To take up any remaining space, fractions
  1598      can be used.
  1600     <h4 id=the-fr-unit><span class=secno>7.7.1. </span>The &lsquo;<code
  1601      class=property>fr</code>&rsquo; unit</h4>
  1603     <p>The <dfn id=fr title="fr (unit)">fr</dfn> unit is used to distribute
  1604      any remaining space in a series of length values. If multiple fractions
  1605      are specified, they take up space proportionally to their numeric value.
  1608     <div class=example>
  1609      <pre>
  1610 border-parts: 10px 1fr 10px;
  1611 border-parts: 10px 1fr 10px 1fr 10px;
  1612 border-parts: 10px 2fr 10px 2fr 10px;
  1613 </pre>
  1614     </div>
  1616     <p>The &lsquo;<code class=css>fr</code>&rsquo; unit can only be used in
  1617      combination with regular length units.
  1619     <h3 id=ltgridgt><span class=secno>7.8. </span>&lt;grid&gt;</h3>
  1621     <p>A grid is a set of invisible vertical and horizontal lines that can be
  1622      used to align content. In CSS3, a grid lines can be established
  1623      implicitly or explicitly <a href="#CSS3COL"
  1624      rel=biblioentry>[CSS3COL]<!--{{!CSS3COL}}--></a> <a href="#CSS3GRID"
  1625      rel=biblioentry>[CSS3GRID]<!--{{!CSS3GRID}}--></a>. In any case, the
  1626      distance between grid lines can be referred to by the &lsquo;<code
  1627      class=css>gr</code>&rsquo; unit.
  1629     <h4 id=the-gr-unit><span class=secno>7.8.1. </span>The &lsquo;<code
  1630      class=property>gr</code>&rsquo; unit</h4>
  1632     <p>The <dfn id=gr title="gr (unit)">gr</dfn> unit is used to position
  1633      elements in relation to grid lines.
  1635     <div class=example>
  1636      <pre>
  1637 img { 
  1638   float: top left multicol; 
  1639   float-offset: 2gr; 
  1640   width: 1gr }
  1642 </pre>
  1643     </div>
  1645     <p>Grid lines can be laid out in uneven patterns. Therefore, the
  1646      &lsquo;<code class=css>gr</code>&rsquo; unit is not linear.
  1648     <div class=example>
  1649      <p>For example, "2gr" is not necessarily twice as long as "1gr".
  1650     </div>
  1651     <!--
  1653 <h3>Special cases</h3>
  1655 <p>Two common types of values fall outside the types
  1656 described above: the value for font families and the hexadecimal color
  1657 notation.
  1659 <h4>Font families</h4>
  1661 <p>The <span class="property">'font'</span>
  1662 and <span class="property">'font-family'</span> properties accept a
  1663 comma-separated list of font families. Font families can either be the
  1664 name of a certain font, or it can be one of
  1665 five <em class="index">generic font families</em>: 'serif',
  1666 'sans-serif', 'cursive','fantasy', and 'monospace'. Font family names
  1667 are like strings, except that the quotes around them may be omitted.
  1668 If quoting is omitted, any white space characters before and after the
  1669 font name are ignored and any sequence of white space characters
  1670 inside the font name is converted to a single space. Font family names
  1671 that happen to be the same as a keyword value (e.g. 'initial',
  1672 'inherit', 'default', 'serif', 'sans-serif', 'monospace', 'fantasy',
  1673 and 'cursive') must be quoted to prevent confusion with the keywords
  1674 with the same names. UAs must not consider these keywords as matching
  1675 the ''&lt;family-name&gt;'' type.
  1677 <p>Generic font family names are keywords and must not be quoted.
  1679 <div class="example">
  1680 <pre>body { font-family: "Helvetica", "Univers", "Arial", sans-serif }</pre>
  1681 </div>
  1682 -->
  1684     <h2 id=specified-computed-used-and-actual-value><span class=secno>8.
  1685      </span>Specified, computed, used, and actual values</h2>
  1687     <p>The final value of a CSS3 property for a given element is the result
  1688      of a four-step calculation. First, cascading and inheritance yields the
  1689      <a href="#specified-value"><em>specified value</em></a> <a
  1690      href="#CSS3CASCADE"
  1691      rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>. Second,
  1692      relative values are computed into absolute values as far as possible
  1693      without formatting the document, thereby yielding the <a
  1694      href="#computed-value"><em>computed value</em></a>. The computed value
  1695      is transformed into the <a href="#used-value"><em>used value</em></a> in
  1696      the formatting process. Finally, the computed value is transformed to
  1697      the <a href="#actual-value"><em>actual value</em></a> based on
  1698      constraints in the user agent.</p>
  1700     <h3 id=finding-the-specified-value><span class=secno>8.1. </span>Finding
  1701      the <dfn id=specified-value>specified value</dfn></h3>
  1703     <p>The <a href="#specified-value"><em>specified value</em></a> is the
  1704      output of the cascading and inheritance process <a href="#CSS3CASCADE"
  1705      rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>.
  1707     <h3 id=finding-the-computed-value><span class=secno>8.2. </span>Finding
  1708      the <dfn id=computed-value>computed value</dfn></h3>
  1710     <p>Specified values may be absolute (i.e., they are not specified
  1711      relative to another value, as in &lsquo;<code
  1712      class=property>red</code>&rsquo; or &lsquo;<code
  1713      class=css>2mm</code>&rsquo;) or relative (i.e., they are specified
  1714      relative to another value, as in &lsquo;<code
  1715      class=property>auto</code>&rsquo;, &lsquo;<code
  1716      class=css>2em</code>&rsquo;). For absolute values, no processing is
  1717      needed to find the computed value.</p>
  1719     <p>For relative values, on the other hand, computation is necessary to
  1720      find the computed values: percentages must be multiplied by a reference
  1721      value (each property defines which value that is), values with relative
  1722      units (em, ex, px) must be made absolute by multiplying with the
  1723      appropriate font or pixel size, &lsquo;<code
  1724      class=property>auto</code>&rsquo; values must be computed by the
  1725      formulas given with each property, certain keywords (e.g., &lsquo;<code
  1726      class=property>smaller</code>&rsquo;, &lsquo;<code
  1727      class=property>bolder</code>&rsquo;) must be replaced according to their
  1728      definitions. See example (f), (g) and (h) in the table below.</p>
  1730     <p>Also, relative URIs are computed into absolute URIs at this stage. The
  1731      computed value of invalid and absolute URIs is the same as the specified
  1732      value.
  1734     <h3 id=finding-the-used-value><span class=secno>8.3. </span>Finding the
  1735      <dfn id=used-value>used value</dfn></h3>
  1737     <p>Computed values are processed as far as possible without formatting
  1738      the document. Some values, however, can only be determined when the
  1739      document is being laid out. For example, if the width of an element is
  1740      set to be a certain percentage of its containing block, the width cannot
  1741      be determined until the width of the containing block has been
  1742      determined. The used value is the result of taking the computed value
  1743      and resolving any remaining dependencies into an absolute value.
  1745     <h3 id=finding-the-actual-value><span class=secno>8.4. </span>Finding the
  1746      <dfn id=actual-value>actual value</dfn></h3>
  1748     <p>A used value is in principle ready to be used, but a user agent may
  1749      not be able to make use of the value in a given environment. For
  1750      example, a user agent may only be able to render borders with integer
  1751      pixel widths and may therefore have to approximate the computed width.
  1752      Also, the font size of an element may need adjustment based on the
  1753      availability of fonts or the value of the &lsquo;<code
  1754      class=property>font-size-adjust</code>&rsquo; property. The actual value
  1755      is the computed value after adjustments have been made.
  1757     <p>By probing the actual values of elements, much can be learned about
  1758      how the document is laid out. However, not all information is recorded
  1759      in the actual values. For example, the actual value of the &lsquo;<code
  1760      class=property>page-break-after</code>&rsquo; property does not reflect
  1761      whether there is a page break or not after the element. Similarly, the
  1762      actual value of &lsquo;<code class=property>orphans</code>&rsquo; does
  1763      not reflect how many orphan lines there is in a certain element. See
  1764      examples (j) and (k) in the table below.
  1766     <table>
  1767      <tbody>
  1768       <tr>
  1769        <th>Example
  1771        <th>Winning declaration
  1773        <th>Property</th>
  1774        <!--      <th>Cascaded value</th>  -->
  1776        <th>Specified value
  1778        <th>Computed value
  1780        <th>Used value
  1782        <th>Actual value
  1784       <tr>
  1785        <td>a
  1787        <td><tt class=declaration>text-align: left</tt>
  1789        <td>text-align</td>
  1790        <!--      <td>left</td>-->
  1792        <td>left
  1794        <td>left
  1796        <td>left
  1798        <td>left
  1800       <tr>
  1801        <td>b
  1803        <td><tt class=declaration>border-width: inherit</tt>
  1805        <td>border-top-width, border-right-width, border-bottom-width,
  1806         border-left-width</td>
  1807        <!--      <td>inherit</td> -->
  1809        <td class=say>4.2px
  1811        <td>4.2px
  1813        <td>4.2px
  1815        <td>4px
  1817       <tr>
  1818        <td>c
  1820        <td>(no winning declaration)
  1822        <td>width</td>
  1823        <!--      <td>(no specified value)</td>-->
  1825        <td>auto (initial&nbsp;value)
  1827        <td>auto
  1829        <td>120px
  1831        <td>120px
  1833       <tr>
  1834        <td>d
  1836        <td><tt class=declaration>list-style-position: inherit</tt>
  1838        <td>list-style-position</td>
  1839        <!--      <td>inherit</td> -->
  1841        <td class=say>inside
  1843        <td>inside
  1845        <td>inside
  1847        <td>inside
  1849       <tr>
  1850        <td>e
  1852        <td><tt class=declaration>list-style-position: initial</tt>
  1854        <td>list-style-position</td>
  1855        <!--      <td>initial</td>-->
  1857        <td>outside (initial&nbsp;value)
  1859        <td>outside
  1861        <td>outside
  1863        <td>outside
  1865       <tr>
  1866        <td>f
  1868        <td><tt class=declaration>font-size: 1.2em</tt>
  1870        <td>font-size</td>
  1871        <!--      <td>1.2em</td>-->
  1873        <td>1.2em
  1875        <td class=say>14.1px
  1877        <td>14.1px
  1879        <td>14px
  1881       <tr>
  1882        <td>g
  1884        <td><tt class=declaration>width: 80%</tt>
  1886        <td>width</td>
  1887        <!--      <td>80%</td>-->
  1889        <td>80%
  1891        <td>80%
  1893        <td class=say>354.2px
  1895        <td>354px
  1897       <tr>
  1898        <td>h
  1900        <td><tt class=declaration>width: auto</tt>
  1902        <td>width</td>
  1903        <!--      <td>auto</td>-->
  1905        <td>auto
  1907        <td>auto
  1909        <td class=say>134px
  1911        <td>134px
  1913       <tr>
  1914        <td>i
  1916        <td><tt class=declaration>height: auto</tt>
  1918        <td>height</td>
  1919        <!--      <td>auto</td>-->
  1921        <td>auto
  1923        <td>auto
  1925        <td class=say>176px
  1927        <td>176px
  1929       <tr>
  1930        <td>j
  1932        <td>(no winning declaration)
  1934        <td>page-break-after</td>
  1935        <!--      <td>(no specified value)</td>-->
  1937        <td>auto (initial&nbsp;value)
  1939        <td>auto
  1941        <td>auto
  1943        <td>auto
  1945       <tr>
  1946        <td>k
  1948        <td><tt class=declaration>orphans: 3</tt>
  1950        <td>orphans</td>
  1951        <!--      <td>3</td>-->
  1953        <td>3
  1955        <td>3
  1957        <td>3
  1959        <td>3
  1960     </table>
  1962     <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
  1964     <p>Comments and suggestions from Giovanni Campagna, Christoph P&auml;per,
  1965      Keith Rarick, Alex Mogilevsky, Ian Hickson, David Baron, Edward
  1966      Welbourne, Boris Zbarsky, Bj&ouml;rn H&ouml;hrmann and Michael Day
  1967      improved this module. <!--
  1969 Ian's proposal:
  1970   http://lists.w3.org/Archives/Member/w3c-css-wg/2002OctDec/0141.html
  1971 David's proposal
  1972   http://lists.w3.org/Archives/Member/w3c-css-wg/2002OctDec/0191.html
  1974 -->
  1977     <h2 class=no-num id=references>References</h2>
  1979     <h3 class=no-num id=normative-references>Normative references</h3>
  1980     <!--begin-normative--> <!-- Sorted by label -->
  1981     <dl class=bibliography>
  1982      <dt style="display:
  1983       none"><!-- keeps the doc valid if the DL is empty --> <!---->
  1985      <dt id=CSS21>[CSS21]
  1987      <dd>Bert Bos; et al. <a
  1988       href="http://www.w3.org/TR/2011/REC-CSS2-20110607"><cite>Cascading
  1989       Style Sheets Level 2 Revision 1 (CSS&#160;2.1)
  1990       Specification.</cite></a> 7 June 2011. W3C Recommendation. URL: <a
  1991       href="http://www.w3.org/TR/2011/REC-CSS2-20110607">http://www.w3.org/TR/2011/REC-CSS2-20110607</a>
  1992       </dd>
  1993      <!---->
  1995      <dt id=CSS3CASCADE>[CSS3CASCADE]
  1997      <dd>H&#229;kon Wium Lie. <a
  1998       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215"><cite>CSS3
  1999       module: Cascading and inheritance.</cite></a> 15 December 2005. W3C
  2000       Working Draft. (Work in progress.) URL: <a
  2001       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215">http://www.w3.org/TR/2005/WD-css3-cascade-20051215</a>
  2002       </dd>
  2003      <!---->
  2005      <dt id=CSS3COL>[CSS3COL]
  2007      <dd>H&#229;kon Wium Lie. <a
  2008       href="http://www.w3.org/TR/2011/CR-css3-multicol-20110412"><cite>CSS
  2009       Multi-column Layout Module.</cite></a> 12 April 2011. W3C Candidate
  2010       Recommendation. (Work in progress.) URL: <a
  2011       href="http://www.w3.org/TR/2011/CR-css3-multicol-20110412">http://www.w3.org/TR/2011/CR-css3-multicol-20110412</a>
  2012       </dd>
  2013      <!---->
  2015      <dt id=CSS3COLOR>[CSS3COLOR]
  2017      <dd>Tantek &#199;elik; Chris Lilley; L. David Baron. <a
  2018       href="http://www.w3.org/TR/2011/REC-css3-color-20110607"><cite>CSS
  2019       Color Module Level 3.</cite></a> 7 June 2011. W3C Recommendation. URL:
  2020       <a
  2021       href="http://www.w3.org/TR/2011/REC-css3-color-20110607">http://www.w3.org/TR/2011/REC-css3-color-20110607</a>
  2022       </dd>
  2023      <!---->
  2025      <dt id=CSS3GRID>[CSS3GRID]
  2027      <dd>Alex Mogilevsky; Markus Mielke. <a
  2028       href="http://www.w3.org/TR/2007/WD-css3-grid-20070905"><cite>CSS Grid
  2029       Positioning Module Level&#160;3.</cite></a> 5 September 2007. W3C
  2030       Working Draft. (Work in progress.) URL: <a
  2031       href="http://www.w3.org/TR/2007/WD-css3-grid-20070905">http://www.w3.org/TR/2007/WD-css3-grid-20070905</a>
  2032       </dd>
  2033      <!---->
  2034     </dl>
  2035     <!--end-normative-->
  2036     <h3 class=no-num id=other-references>Other references</h3>
  2037     <!--begin-informative--> <!-- Sorted by label -->
  2038     <dl class=bibliography>
  2039      <dt style="display:
  2040       none"><!-- keeps the doc valid if the DL is empty --> <!---->
  2042      <dt id=CSS3CASCADE>[CSS3CASCADE]
  2044      <dd>H&#229;kon Wium Lie. <a
  2045       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215"><cite>CSS3
  2046       module: Cascading and inheritance.</cite></a> 15 December 2005. W3C
  2047       Working Draft. (Work in progress.) URL: <a
  2048       href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215">http://www.w3.org/TR/2005/WD-css3-cascade-20051215</a>
  2049       </dd>
  2050      <!---->
  2052      <dt id=CSS3NAMESPACE>[CSS3NAMESPACE]
  2054      <dd>Elika J. Etemad; Anne van Kesteren. <a
  2055       href="http://www.w3.org/TR/2008/CR-css3-namespace-20080523/"><cite>CSS
  2056       Namespaces Module.</cite></a> 23 May 2008. W3C Candidate
  2057       Recommendation. (Work in progress.) URL: <a
  2058       href="http://www.w3.org/TR/2008/CR-css3-namespace-20080523/">http://www.w3.org/TR/2008/CR-css3-namespace-20080523/</a>
  2059       </dd>
  2060      <!---->
  2062      <dt id=URI>[URI]
  2064      <dd>T. Berners-Lee; R. Fielding; L. Masinter. <a
  2065       href="http://www.ietf.org/rfc/rfc3986.txt"><cite>Uniform Resource
  2066       Identifiers (URI): generic syntax.</cite></a> January 2005. Internet
  2067       RFC 3986. URL: <a
  2068       href="http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a>
  2069       </dd>
  2070      <!---->
  2071     </dl>
  2072     <!--end-informative-->
  2073     <h2 class=no-num id=index>Index</h2>
  2074     <!--begin-index-->
  2075     <ul class=indexlist>
  2076      <li>absolute length units, <a href="#absolute-length-units"
  2077       title="absolute length units"><strong>6.2.</strong></a>
  2079      <li>actual value, <a href="#actual-value" title="actual
  2080       value"><strong>8.4.</strong></a>
  2082      <li>&lt;angle&gt;, <a href="#angle-value"
  2083       title="&lt;angle&gt;"><strong>7.1.</strong></a>
  2085      <li>calc(), <a href="#calc" title="calc()"><strong>7.3.1.</strong></a>
  2087      <li>ch, <a href="#ch-unit" title=ch><strong>6.1.1.</strong></a>
  2089      <li>color, <a href="#color" title=color><strong>7.4.</strong></a>
  2091      <li>&lt;color&gt;, <a href="#ltcolorgt0"
  2092       title="&lt;color&gt;"><strong>7.4.</strong></a>
  2094      <li>compound value, <a href="#compound-value" title="compound
  2095       value"><strong>3.1.</strong></a>
  2097      <li>computed value, <a href="#computed-value" title="computed
  2098       value"><strong>8.2.</strong></a>
  2100      <li>deg, <a href="#deg" title=deg><strong>7.1.</strong></a>
  2102      <li>dimension, <a href="#dimension"
  2103       title=dimension><strong>6.</strong></a>
  2105      <li>em, <a href="#em-unit" title=em><strong>6.1.1.</strong></a>
  2107      <li>ex, <a href="#ex-unit" title=ex><strong>6.1.1.</strong></a>
  2109      <li>&lt;frequency&gt;, <a href="#frequency-value"
  2110       title="&lt;frequency&gt;"><strong>7.3.</strong></a>
  2112      <li>fr (unit), <a href="#fr" title="fr
  2113       (unit)"><strong>7.7.1.</strong></a>
  2115      <li>functional notation, <a href="#functional-notation0"
  2116       title="functional notation"><strong>3.1.</strong></a>
  2118      <li>grad, <a href="#grad" title=grad><strong>7.1.</strong></a>
  2120      <li>gr (unit), <a href="#gr" title="gr
  2121       (unit)"><strong>7.8.1.</strong></a>
  2123      <li>Hz, <a href="#hz" title=Hz><strong>7.3.</strong></a>
  2125      <li>identifier, <a href="#identifier"
  2126       title=identifier><strong>4.</strong></a>
  2128      <li><a href="#identifier-value"><code>&lt;identifier&gt;</code></a>, <a
  2129       href="#identifier-value"
  2130       title="&lt;identifier&gt;"><strong>4.2.</strong></a>
  2132      <li>&lsquo;<code class=css>inherit</code>&rsquo;, <a href="#inherit"
  2133       title="''inherit''"><strong>4.1.1.</strong></a>
  2135      <li>&lsquo;<code class=css>initial</code>&rsquo;, <a href="#initial"
  2136       title="''initial''"><strong>4.1.1.</strong></a>
  2138      <li>integer, <a href="#integer" title=integer><strong>5.1.</strong></a>
  2140      <li><a href="#integer-value"><code>&lt;integer&gt;</code></a>, <a
  2141       href="#integer-value" title="&lt;integer&gt;"><strong>5.1.</strong></a>
  2144      <li>kHz, <a href="#khz" title=kHz><strong>7.3.</strong></a>
  2146      <li><a href="#length-value"><code>&lt;length&gt;</code></a>, <a
  2147       href="#length-value" title="&lt;length&gt;"><strong>6.</strong></a>
  2149      <li>max(), <a href="#max" title="max()"><strong>7.3.1.</strong></a>
  2151      <li>min(), <a href="#min" title="min()"><strong>7.3.1.</strong></a>
  2153      <li>ms, <a href="#ms" title=ms><strong>7.2.</strong></a>
  2155      <li>number, <a href="#number" title=number><strong>5.2.</strong></a>
  2157      <li><a href="#number-value"><code>&lt;number&gt;</code></a>, <a
  2158       href="#number-value" title="&lt;number&gt;"><strong>5.2.</strong></a>
  2160      <li><a href="#percentage-value"><code>&lt;percentage&gt;</code></a>, <a
  2161       href="#percentage-value"
  2162       title="&lt;percentage&gt;"><strong>5.3.</strong></a>
  2164      <li>rad, <a href="#rad" title=rad><strong>7.1.</strong></a>
  2166      <li>reference pixel, <a href="#reference-pixel" title="reference
  2167       pixel"><strong>6.2.</strong></a>
  2169      <li>relative length, <a href="#relative-length-units" title="relative
  2170       length"><strong>6.1.</strong></a>
  2172      <li>rem, <a href="#rem-unit" title=rem><strong>6.1.1.</strong></a>
  2174      <li>s, <a href="#s" title=s><strong>7.2.</strong></a>
  2176      <li>simple value, <a href="#simple-value" title="simple
  2177       value"><strong>3.1.</strong></a>
  2179      <li>specified value, <a href="#specified-value" title="specified
  2180       value"><strong>8.1.</strong></a>
  2182      <li><a href="#string-value"><code>&lt;string&gt;</code></a>, <a
  2183       href="#string-value" title="&lt;string&gt;"><strong>4.3.</strong></a>
  2185      <li>&lt;time&gt;, <a href="#time-value"
  2186       title="&lt;time&gt;"><strong>7.2.</strong></a>
  2188      <li>turn, <a href="#turn" title=turn><strong>7.1.</strong></a>
  2190      <li>URL, <a href="#url" title=URL><strong>4.4.</strong></a>
  2192      <li><a href="#url-value"><code>&lt;url&gt;</code></a>, <a
  2193       href="#url-value" title="&lt;url&gt;"><strong>4.4.</strong></a>
  2195      <li>used value, <a href="#used-value" title="used
  2196       value"><strong>8.3.</strong></a>
  2198      <li>vh, <a href="#vh-unit" title=vh><strong>6.1.2.</strong></a>
  2200      <li>vm, <a href="#vm-unit" title=vm><strong>6.1.2.</strong></a>
  2202      <li>vw, <a href="#vw-unit" title=vw><strong>6.1.2.</strong></a>
  2203     </ul>
  2204     <!--end-index-->
  2205   </dl>

mercurial