Advertisement
Guest User

W3C_Selectors.html

a guest
Jun 23rd, 2013
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- http://www.w3.org/TR/2001/CR-css3-selectors-20011113/ -->
  2. <html><head><title>Selectors</title>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <meta http-equiv="Content-Style-Type" content="text/css">
  5. <meta http-equiv="Content-Language" content="en">
  6. <link href="default.css" type="text/css" rel="stylesheet">
  7. <style type="text/css">
  8. pre {
  9.     border-right: medium none; padding-right: 0.3cm; border-top: medium none; padding-left: 0.3cm; font-size: 92%; padding-bottom: 0px; margin: 1em 1cm; border-left: medium none; padding-top: 0px; border-bottom: medium none; white-space: pre; background-color: #d5d5d5
  10. }
  11. .code {
  12.     font-family: monospace
  13. }
  14. table.selectorsReview th {
  15.     background: gray; color: white
  16. }
  17. table.selectorsReview th .pattern {
  18.     width: 20%; font-family: monospace
  19. }
  20. table.selectorsReview th .meaning {
  21.     width: 45%
  22. }
  23. table.selectorsReview tr .described {
  24.     WIDTH: 25%
  25. }
  26. table.selectorsReview tr .origin {
  27.     width: 10%; text-align: center
  28. }
  29. table.tprofile th.title {
  30.     background: gray; color: white
  31. }
  32. table.tprofile th {
  33.     width: 29%
  34. }
  35. table.tprofile td {
  36.     width: 71%
  37. }
  38. .toc {
  39.     list-style-type: none
  40. }
  41. .subtoc ul {
  42.     list-style-type: none
  43. }
  44. .subtoc ol {
  45.     list-style-type: none
  46. }
  47. .profile {
  48.     margin: 1cm
  49. }
  50. .editorNote {
  51.     color: red; font-style: italic
  52. }
  53. .e-mail {
  54.     font-size: 90%
  55. }
  56. h1 {
  57.     font-size: 200%
  58. }
  59. h2 {
  60.     font-size: 170%
  61. }
  62. h3 {
  63.     font-size: 150%
  64. }
  65. h4 {
  66.     font-size: 130%
  67. }
  68. h5 {
  69.     font-size: 120%
  70. }
  71. h6 {
  72.     font-size: 110%
  73. }
  74. ul.changes {
  75.     font-size: smaller
  76. }
  77. table.selectorsReview {
  78.     font-size: smaller; border-collapse: collapse
  79. }
  80. .figure {
  81.     text-align: center
  82. }
  83. </style>
  84. <link href="http://www.w3.org/StyleSheets/TR/W3C-CR.css" type="text/css" rel="stylesheet">
  85. </head>
  86. <body>
  87. <div class="head"><p><a href="http://www.w3.org/"><img height="48" alt="W3C" src="http://www.w3.org/Icons/w3c_home" width="72"></a>
  88. </p><h1><span class="modulename">Selectors</span></h1>
  89.   <h2>W3C Candidate Recommendation 13 November 2001</h2>
  90.   <dl>
  91.     <dt>This version:
  92.     </dt><dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
  93.                  http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
  94.     </dd><dt>Latest version:
  95.     </dt><dd><a href="http://www.w3.org/TR/css3-selectors">
  96.                  http://www.w3.org/TR/css3-selectors</a>
  97.     </dd><dt>Previous version:
  98.     </dt><dd><a href="http://www.w3.org/TR/2001/WD-css3-selectors-20010126">
  99.                  http://www.w3.org/TR/2001/WD-css3-selectors-20010126</a>
  100.     </dd><dt><a name="editors-list"></a>Editors:
  101.     </dt><dd><a href="mailto:glazman@netscape.com">Daniel Glazman</a> (<span class="company"><a href="http://www.netscape.com/">Netscape/AOL</a></span>)
  102.     </dd><dd><a href="mailto:tantekc@microsoft.com">Tantek Çelik</a> (<span class="company"><a href="http://www.microsoft.com/">Microsoft Corporation</a></span>)
  103.     </dd><dd><a href="mailto:ian@hixie.ch">Ian Hickson</a>
  104.     </dd><dd>Peter Linss (former editor, formerly of&nbsp;<span class="company"><a href="http://www.netscape.com/">Netscape/AOL</a></span>)
  105.     </dd><dd>John Williams (former editor, <span class="company"><a href="http://www.quark.com/">Quark, Inc.</a></span>)
  106.   </dd></dl>
  107. <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">Copyright</a>
  108. ©2001 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></a>,
  109. <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</a>,
  110. <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</a>,
  111. <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document
  112. use</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software
  113. licensing</a> rules apply.
  114. </p><hr title="Separator for header">
  115. </div>
  116.  
  117. <h2><a name="abstract"></a>Abstract</h2>
  118. <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading Style Sheets) is a language for describing the rendering of
  119.   <acronym title="Hypertext Markup Language">HTML</acronym> and <acronym title="Extensible Markup Language">XML</acronym>
  120.   documents on screen, on paper, in speech, etc. To bind style properties
  121.   to elements in the document, CSS uses <em>selectors,</em> which are patterns
  122.   that match one or more elements. This document describes the selectors that are proposed
  123.   for CSS level 3. It includes and extends the selectors of CSS level 2.
  124. </p><h2><a name="status"></a>Status of this document</h2>
  125. <p>This document is one of the "modules" of the upcoming CSS3 specification. It
  126.   not only describes the selectors that already exist in <a href="#CSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a href="#CSS2"><abbr title="CSS level 2">CSS2</abbr></a>,
  127.   but also proposes new selectors for <abbr title="CSS level 3">CSS3</abbr> as well as for
  128.   other languages that may need them. The CSS Working Group doesn't expect that all
  129.  implementations of CSS3 will have to implement all selectors. Instead,
  130.  there will probably be a small number of variants of CSS3, so-called "profiles".
  131.  For example, it may be that only a profile for non-interactive user agents
  132.  will include all of the proposed selectors.
  133. </p><p>This specification is being put forth as a <a href="http://www.w3.org/TR/#About">Candidate
  134.  Recommendation</a> by the <a href="http://www.w3.org/Style/Group">CSS Working
  135.  Group</a>. This document is a revision of the <a href="http://www.w3.org/TR/2001/WD-css3-selectors-20010126">Working
  136.  Draft dated 2001 January 26</a>, and has incorporated suggestions received
  137.  during last call review, comments, and further deliberations of the W3C CSS
  138.  Working Group.
  139. </p><p>The duration of Candidate Recommendation is expected to last approximately
  140.  six months (ending <strong>May, 2002</strong>). All persons are encouraged
  141.  to review and implement this specification and return comments to the (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing
  142.  list <a href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a> (see <a href="http://www.w3.org/Mail/Request">instructions</a>).
  143.  W3C Members can also send comments directly to the CSS Working Group.
  144. </p><p>Should this specification prove impossible to implement, the Working Group
  145.  will return the document to Working Draft status and make necessary changes.
  146.  Otherwise, the Working Group anticipates asking the W3C Director to advance
  147.  this document to Proposed Recommendation.
  148. </p><p>This is still a draft document and may be updated, replaced, or obsoleted by
  149.  other documents at any time. It is inappropriate to cite a W3C Candidate Recommendation
  150.  as other than "work in progress." A list of current W3C working drafts
  151.  can be found at <a href="http://www.w3.org/TR">http://www.w3.org/TR</a>.<br>
  152.  <br>
  153.  This document may be available in <a href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
  154.  The English version of this specification is the only normative version.
  155. </p><h2><a name="dependencies"></a>Dependencies with other CSS3 Modules</h2>
  156. <ul>
  157.  <li>General Syntax
  158.  </li><li>Value Assignment, Cascade and Inheritance
  159.  </li><li>Generated Content / Markers
  160.  </li><li>User Interface
  161. </li></ul>
  162. <div class="subtoc">
  163. <h2><a name="contents">Table of contents</a></h2>
  164. <ul class="toc">
  165.  <li class="tocline2"><a href="#context">1.
  166.  Context</a>
  167.  <ul>
  168.    <li><a href="#changesFromCSS2">1.1
  169.    Changes from CSS2</a> </li></ul>
  170.  </li><li class="tocline2"><a href="#selectors">2.
  171.  Selectors</a>
  172.  </li><li class="tocline2"><a href="#casesens">3.
  173.  Case sensitivity</a>
  174.  </li><li class="tocline2"><a href="#selector-syntax">4. Selector
  175.  syntax</a>
  176.  </li><li class="tocline2"><a href="#grouping">5.
  177.  Groups of selectors</a>
  178.  </li><li class="tocline2"><a href="#simple-selectors">6. Simple
  179.  selectors</a>
  180.  <ul class="toc">
  181.    <li class="tocline3"><a href="#type-selectors">6.1 Type
  182.    selectors</a>
  183.    <ul class="toc">
  184.      <li class="tocline4"><a href="#typenmsp">6.1.1 Type selectors
  185.      and Namespaces</a> </li></ul>
  186.    </li><li class="tocline3"><a href="#universal-selector">6.2 Universal
  187.    selector</a>
  188.    <ul>
  189.      <li><a href="#univnmsp">6.2.1
  190.      Universal selector and Namespaces</a> </li></ul>
  191.    </li><li class="tocline3"><a href="#attribute-selectors">6.3
  192.    Attribute selectors</a>
  193.    <ul class="toc">
  194.      <li class="tocline4"><a href="#attribute-representation">6.3.1
  195.      Representation of attributes and attributes values</a>
  196.      </li><li><a href="#attribute-substrings">6.3.2
  197.      Substring matching attribute selectors</a>
  198.      </li><li class="tocline4"><a href="#attrnmsp">6.3.3 Attribute
  199.      selectors and Namespaces</a>
  200.      </li><li class="tocline4"><a href="#def-values">6.3.4 Default
  201.      attribute values in DTDs</a> </li></ul>
  202.    </li><li class="tocline3"><a href="#class-html">6.4 Class
  203.    selectors</a>
  204.    </li><li class="tocline3"><a href="#id-selectors">6.5 ID
  205.    selectors</a>
  206.    </li><li class="tocline3"><a href="#pseudo-classes">6.6
  207.    Pseudo-classes</a>
  208.    <ul class="toc">
  209.      <li class="tocline4"><a href="#dynamic-pseudos">6.6.1 Dynamic
  210.      pseudo-classes</a>
  211.      </li><li class="tocline4"><a href="#target-pseudo">6.6.2 The
  212.      :target pseudo-class</a>
  213.      </li><li class="tocline4"><a href="#lang-pseudo">6.6.3 The :lang()
  214.      pseudo-class</a>
  215.      </li><li class="tocline4"><a href="#UIstates">6.6.4 UI element
  216.      states pseudo-classes</a>
  217.      </li><li class="tocline4"><a href="#structural-pseudos">6.6.5
  218.      Structural pseudo-classes</a>
  219.      <ul>
  220.        <li><a href="#root-pseudo">:root
  221.        pseudo-class</a>
  222.        </li><li><a href="#nth-child-pseudo">:nth-child()
  223.        pseudo-class</a>
  224.        </li><li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
  225.  
  226.        </li><li><a href="#nth-of-type-pseudo">:nth-of-type()
  227.        pseudo-class</a>
  228.        </li><li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
  229.  
  230.        </li><li><a href="#first-child-pseudo">:first-child
  231.        pseudo-class</a>
  232.        </li><li><a href="#last-child-pseudo">:last-child
  233.        pseudo-class</a>
  234.        </li><li><a href="#first-of-type-pseudo">:first-of-type
  235.        pseudo-class</a>
  236.        </li><li><a href="#last-of-type-pseudo">:last-of-type
  237.        pseudo-class</a>
  238.        </li><li><a href="#only-child-pseudo">:only-child
  239.        pseudo-class</a>
  240.        </li><li><a href="#only-of-type-pseudo">:only-of-type
  241.        pseudo-class</a>
  242.        </li><li><a href="#empty-pseudo">:empty
  243.        pseudo-class</a> </li></ul>
  244.      </li><li class="tocline4"><a href="#content-selectors">6.6.6
  245.      Content pseudo-class</a>
  246.      </li><li><a href="#negation">6.6.7 The
  247.      negation pseudo-class</a> </li></ul></li></ul>
  248.  </li><li><a href="#pseudo-elements">7.
  249.  Pseudo-elements</a>
  250.  <ul>
  251.    <li><a href="#first-line">7.1 The
  252.    :first-line pseudo-element</a>
  253.    </li><li><a href="#first-letter">7.2 The
  254.    :first-letter pseudo-element</a>
  255.    </li><li><a href="#UIfragments">7.3 UI
  256.    element fragments pseudo-elements</a>
  257.    </li><li><a href="#gen-content">7.4 The
  258.    :before and :after pseudo-elements</a> </li></ul>
  259.  </li><li class="tocline2"><a href="#combinators">8. Combinators</a>
  260.  <ul class="toc">
  261.    <li class="tocline3"><a href="#descendant-combinators">8.1
  262.    Descendant combinators</a>
  263.    </li><li class="tocline3"><a href="#child-combinators">8.2 Child
  264.    combinators</a>
  265.    </li><li class="tocline3"><a href="#adjacent-combinators">8.3
  266.    Adjacent sibling combinators</a>
  267.    <ul class="toc">
  268.      <li class="tocline4"><a href="#adjacent-d-combinators">8.3.1
  269.      Adjacent direct combinators</a>
  270.      </li><li class="tocline4"><a href="#adjacent-i-combinators">8.3.2
  271.      Adjacent indirect combinators</a> </li></ul></li></ul>
  272.  </li><li class="tocline2"><a href="#specificity">9. Calculating a
  273.  selector's specificity</a>
  274.   </li><li class="tocline2"><a href="#w3cselgrammar">10. The grammar of
  275.   <span class="modulename">Selectors</span></a>
  276.   <ul class="toc">
  277.     <li class="tocline3"><a href="#grammar">10.1 Grammar</a>
  278.     </li><li class="tocline3"><a href="#lex">10.2
  279.     Lexical scanner</a> </li></ul>
  280.   </li><li class="tocline2"><a href="#downlevel">11. Namespaces and
  281.   Down-Level clients</a>
  282.   </li><li class="tocline2"><a href="#profiling">12. Profiles</a>
  283.   </li><li><a href="#Conformance">13. Conformance
  284.   and Requirements</a>
  285.   </li><li><a href="#Tests">14. Tests</a>
  286.   </li><li><a href="#ACKS">15.
  287.   Acknowledgements</a>
  288.   </li><li class="tocline2"><a href="#references">16. References</a> <!--<li class="tocline2"><a href="#changes">Changes from previous version</a>--></li></ul></div>
  289. <h2><a name="context">1. Context</a></h2>
  290. <p>Members of the CSS+FP Working Group proposed during the Clamart meeting to
  291. modularize the CSS specification.
  292. </p><p>This modularization, and the externalization of the general syntax of CSS
  293. will reduce the size of the specification and allow new specifications
  294. to use selectors and/or CSS general syntax. For instance, behaviors or tree
  295. transformations.
  296. </p><p>This specification contains its own <a href="#Tests">test cases</a>, one test per concept introduced in this document.
  297.   These tests are not full conformance tests but are intended to provide users
  298.   with a way to check if a part of this specification is implemented <i>ad minima</i>
  299.   or is not implemented at all.
  300. </p><h3><a name="changesFromCSS2"></a>1.1 Changes from CSS2</h3>
  301. <p>The main differences between the selectors in CSS2 and those in
  302.  <span class="modulename">Selectors</span> are:
  303. </p><ul>
  304.   <li>the list of basic definitions (selector, group of selectors, simple
  305.   selector, etc.) has been clarified
  306.   </li><li>an optional namespace component is now allowed in type element selectors,
  307.   the universal selector and attribute selectors
  308.   </li><li>a new combinator
  309.   </li><li>new simple selectors including substring matching attribute selectors, and new
  310.   pseudo-classes
  311.   </li><li>new pseudo-elements, and introduction of the "::" convention for pseudo-elements
  312.   </li><li>a rewriting of the selectors grammar
  313.   </li><li>profiles to be added to specifications integrating <span class="modulename">Selectors</span> and
  314.   defining the set of selectors which is actually supported by each
  315.   specification
  316.   </li><li><span class="modulename">Selectors</span> are now a CSS3 Module and an independent specification.
  317.   Other  specifications can now refer to this document independently of CSS
  318.   </li><li>the specification now contains its own test suite. </li>
  319. </ul>
  320. <h2><a name="selectors"></a>2. Selectors</h2>
  321. <p>A <span class="propernoun">Selector</span> represents a structure. This structure can be used
  322. as a condition (e.g. in a CSS rule) that determines which elements
  323. a selector matches in the document tree, or as a flat description of the
  324. HTML or XML fragment corresponding to that structure.
  325. </p><p><span class="propernoun">Selectors</span> may range from simple element names to rich contextual
  326. representations.
  327. </p><p>The following table summarizes <span class="propernoun">Selector</span> syntax:
  328. </p><table class="selectorsreview" width="100%" border="1">
  329.   <tbody>
  330.   <tr>
  331.     <th class="pattern">Pattern</th>
  332.     <th class="meaning">Meaning</th>
  333.     <th class="described">Described in section</th>
  334.     <th class="origin">First defined in CSS level</th></tr>
  335.   <tr>
  336.     <td class="pattern">*</td>
  337.     <td class="meaning">any element</td>
  338.     <td class="described"><a href="#universal-selector">Universal
  339.       selector</a></td>
  340.     <td class="origin">2</td></tr>
  341.   <tr>
  342.     <td class="pattern">E</td>
  343.     <td class="meaning">an element of type E</td>
  344.     <td class="described"><a href="#type-selectors">Type selector</a></td>
  345.     <td class="origin">1</td></tr>
  346.   <tr>
  347.     <td class="pattern">E[foo]</td>
  348.     <td class="meaning">an E element with a "foo" attribute</td>
  349.     <td class="described"><a href="#attribute-selectors">Attribute
  350.       selectors</a></td>
  351.     <td class="origin">2</td></tr>
  352.   <tr>
  353.     <td class="pattern">E[foo="bar"]</td>
  354.     <td class="meaning">an E element whose "foo" attribute value is exactly
  355.       equal to "bar"</td>
  356.     <td class="described"><a href="#attribute-selectors">Attribute
  357.       selectors</a></td>
  358.     <td class="origin">2</td></tr>
  359.   <tr>
  360.     <td class="pattern">E[foo~="bar"]</td>
  361.     <td class="meaning">an E element whose "foo" attribute value is a list of
  362.       space-separated values, one of which is exactly equal to "bar"</td>
  363.     <td class="described"><a href="#attribute-selectors">Attribute
  364.       selectors</a></td>
  365.     <td class="origin">2</td></tr>
  366.   <tr>
  367.     <td class="pattern">E[foo^="bar"]</td>
  368.     <td class="meaning">an E element whose "foo" attribute value begins exactly
  369.       with the string "bar"</td>
  370.     <td class="described"><a href="#attribute-selectors">Attribute
  371.       selectors</a></td>
  372.     <td class="origin">3</td></tr>
  373.   <tr>
  374.     <td class="pattern">E[foo$="bar"]</td>
  375.     <td class="meaning">an E element whose "foo" attribute value ends exactly
  376.       with the string "bar"</td>
  377.     <td class="described"><a href="#attribute-selectors">Attribute
  378.       selectors</a></td>
  379.     <td class="origin">3</td></tr>
  380.   <tr>
  381.     <td class="pattern">E[foo*="bar"]</td>
  382.     <td class="meaning">an E element whose "foo" attribute value contains the
  383.       substring "bar"</td>
  384.     <td class="described"><a href="#attribute-selectors">Attribute
  385.       selectors</a></td>
  386.     <td class="origin">3</td></tr>
  387.   <tr>
  388.     <td class="pattern">E[hreflang|="en"]</td>
  389.     <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
  390.       list of values beginning (from the left) with "en"</td>
  391.     <td class="described"><a href="#attribute-selectors">Attribute
  392.       selectors</a></td>
  393.     <td class="origin">2</td></tr>
  394.   <tr>
  395.     <td class="pattern">E:root</td>
  396.     <td class="meaning">an E element, root of the document</td>
  397.     <td class="described"><a href="#structural-pseudos">Structural
  398.       pseudo-classes</a></td>
  399.     <td class="origin">3</td></tr>
  400.   <tr>
  401.     <td class="pattern">E:nth-child(n)</td>
  402.     <td class="meaning">an E element, the n-th child of its parent</td>
  403.     <td class="described"><a href="#structural-pseudos">Structural
  404.       pseudo-classes</a></td>
  405.     <td class="origin">3</td></tr>
  406.   <tr>
  407.     <td class="pattern">E:nth-last-child(n)</td>
  408.     <td class="meaning">an E element, the n-th child of its parent, counting
  409.       from the last one</td>
  410.     <td class="described"><a href="#structural-pseudos">Structural
  411.       pseudo-classes</a></td>
  412.     <td class="origin">3</td></tr>
  413.   <tr>
  414.     <td class="pattern">E:nth-of-type(n)</td>
  415.     <td class="meaning">an E element, the n-th sibling of its type</td>
  416.     <td class="described"><a href="#structural-pseudos">Structural
  417.       pseudo-classes</a></td>
  418.     <td class="origin">3</td></tr>
  419.   <tr>
  420.     <td class="pattern">E:nth-last-of-type(n)</td>
  421.     <td class="meaning">an E element, the n-th sibling of its type, counting
  422.       from the last one</td>
  423.     <td class="described"><a href="#structural-pseudos">Structural
  424.       pseudo-classes</a></td>
  425.     <td class="origin">3</td></tr>
  426.   <tr>
  427.     <td class="pattern">E:first-child</td>
  428.     <td class="meaning">an E element, first child of its parent</td>
  429.     <td class="described"><a href="#structural-pseudos">Structural
  430.       pseudo-classes</a></td>
  431.     <td class="origin">2</td></tr>
  432.   <tr>
  433.     <td class="pattern">E:last-child</td>
  434.     <td class="meaning">an E element, last child of its parent</td>
  435.     <td class="described"><a href="#structural-pseudos">Structural
  436.       pseudo-classes</a></td>
  437.     <td class="origin">3</td></tr>
  438.   <tr>
  439.     <td class="pattern">E:first-of-type</td>
  440.     <td class="meaning">an E element, first sibling of its type</td>
  441.     <td class="described"><a href="#structural-pseudos">Structural
  442.       pseudo-classes</a></td>
  443.     <td class="origin">3</td></tr>
  444.   <tr>
  445.     <td class="pattern">E:last-of-type</td>
  446.     <td class="meaning">an E element, last sibling of its type</td>
  447.     <td class="described"><a href="#structural-pseudos">Structural
  448.       pseudo-classes</a></td>
  449.     <td class="origin">3</td></tr>
  450.   <tr>
  451.     <td class="pattern">E:only-child</td>
  452.     <td class="meaning">an E element, only child of its parent</td>
  453.     <td class="described"><a href="#structural-pseudos">Structural
  454.       pseudo-classes</a></td>
  455.     <td class="origin">3</td></tr>
  456.   <tr>
  457.     <td class="pattern">E:only-of-type</td>
  458.     <td class="meaning">an E element, only sibling of its type</td>
  459.     <td class="described"><a href="#structural-pseudos">Structural
  460.       pseudo-classes</a></td>
  461.     <td class="origin">3</td></tr>
  462.   <tr>
  463.     <td class="pattern">E:empty</td>
  464.     <td class="meaning">an E element that has no children (including text
  465.     nodes)</td>
  466.     <td class="described"><a href="#structural-pseudos">Structural
  467.       pseudo-classes</a></td>
  468.     <td class="origin">3</td></tr>
  469.   <tr>
  470.     <td class="pattern">E:link <br>E:visited</td>
  471.     <td class="meaning">an E element being the source anchor of a hyperlink of
  472.       which the target is not yet visited (:link) or already visited
  473.     (:visited)</td>
  474.     <td class="described"><a href="#link">The link
  475.       pseudo-classes</a></td>
  476.     <td class="origin">1</td></tr>
  477.   <tr>
  478.     <td class="pattern">E:active <br>E:hover <br>E:focus</td>
  479.     <td class="meaning">an E element during certain user actions</td>
  480.     <td class="described"><a href="#useraction-pseudos">The user
  481.       action pseudo-classes</a></td>
  482.     <td class="origin">1 and 2</td></tr>
  483.   <tr>
  484.     <td class="pattern">E:target</td>
  485.     <td class="meaning">an E element being the target of the referring URI</td>
  486.     <td class="described"><a href="#target-pseudo">The target
  487.       pseudo-class</a></td>
  488.     <td class="origin">3</td></tr>
  489.   <tr>
  490.     <td class="pattern">E:lang(fr)</td>
  491.     <td class="meaning">an element of type E in language "fr" (the document
  492.       language specifies how language is determined)</td>
  493.     <td class="described"><a href="#lang-pseudo">The :lang()
  494.       pseudo-class&nbsp;</a></td>
  495.     <td class="origin">2</td></tr>
  496.   <tr>
  497.     <td class="pattern">E:enabled<br>E:disabled&nbsp;</td>
  498.     <td class="meaning">a user interface element E which is enabled or
  499.     disabled</td>
  500.     <td class="described"><a href="#UIstates">The UI element states
  501.       pseudo-classes</a></td>
  502.     <td class="origin">3</td></tr>
  503.   <tr>
  504.     <td class="pattern">E:checked<br>E:indeterminate&nbsp;</td>
  505.     <td class="meaning">a user interface element E which is checked or in an
  506.       indeterminate state (for instance a radio-button or checkbox)</td>
  507.     <td class="described"><a href="#UIstates">The UI element states
  508.       pseudo-classes</a></td>
  509.     <td class="origin">3</td></tr>
  510.   <tr>
  511.     <td class="pattern">E:contains("foo")</td>
  512.     <td class="meaning">an E element containing the substring "foo" in its textual
  513.       contents</td>
  514.     <td class="described"><a href="#content-selectors">Content
  515.       pseudo-class</a></td>
  516.     <td class="origin">3</td></tr>
  517.   <tr>
  518.     <td class="pattern">E::first-line</td>
  519.     <td class="meaning">the first formatted line of an E element</td>
  520.     <td class="described"><a href="#first-line">The :first-line
  521.       pseudo-element</a></td>
  522.     <td class="origin">1</td></tr>
  523.   <tr>
  524.     <td class="pattern">E::first-letter</td>
  525.     <td class="meaning">the first formatted letter of an E element</td>
  526.     <td class="described"><a href="#first-letter">The :first-letter
  527.       pseudo-element</a></td>
  528.     <td class="origin">1</td></tr>
  529.   <tr>
  530.     <td class="pattern">E::selection</td>
  531.     <td class="meaning">the portion of an E element that is currently
  532.       selected/highlighted by the user</td>
  533.     <td class="described"><a href="#UIfragments">The UI element
  534.       fragments pseudo-elements</a></td>
  535.     <td class="origin">3</td></tr>
  536.   <tr>
  537.     <td class="pattern">E::before</td>
  538.     <td class="meaning">generated content before an E element</td>
  539.     <td class="described"><a href="#gen-content">The :before
  540.       pseudo-element</a></td>
  541.     <td class="origin">2</td></tr>
  542.   <tr>
  543.     <td class="pattern">E::after</td>
  544.     <td class="meaning">generated content after an E element</td>
  545.     <td class="described"><a href="#gen-content">The :after
  546.       pseudo-element</a></td>
  547.     <td class="origin">2</td></tr>
  548.   <tr>
  549.     <td class="pattern">E.warning</td>
  550.     <td class="meaning">an E element whose class is
  551. "warning" (the document language specifies how class is determined).</td>
  552.     <td class="described"><a href="#class-html">Class
  553.     selectors</a></td>
  554.     <td class="origin">1</td></tr>
  555.   <tr>
  556.     <td class="pattern">E#myid</td>
  557.     <td class="meaning">an E element with ID equal to "myid".</td>
  558.     <td class="described"><a href="#id-selectors">ID
  559.     selectors</a></td>
  560.     <td class="origin">1</td></tr>
  561.   <tr>
  562.     <td class="pattern">E:not(s)</td>
  563.     <td class="meaning">an E element that does not match simple selector s</td>
  564.     <td class="described"><a href="#negation">Negation
  565.       pseudo-class</a></td>
  566.     <td class="origin">3</td></tr>
  567.   <tr>
  568.     <td class="pattern">E F</td>
  569.     <td class="meaning">an F element descendant of an E element</td>
  570.     <td class="described"><a href="#descendant-combinators">Descendant
  571.       combinator</a></td>
  572.     <td class="origin">1</td></tr>
  573.   <tr>
  574.     <td class="pattern">E &gt; F</td>
  575.     <td class="meaning">an F element child of an E element</td>
  576.     <td class="described"><a href="#child-combinators">Child
  577.       combinator</a></td>
  578.     <td class="origin">2</td></tr>
  579.   <tr>
  580.     <td class="pattern">E + F</td>
  581.     <td class="meaning">an F element immediately preceded by an E element</td>
  582.     <td class="described"><a href="#adjacent-d-combinators">Direct
  583.       adjacent combinator</a></td>
  584.     <td class="origin">2</td></tr>
  585.   <tr>
  586.     <td class="pattern">E ~ F</td>
  587.     <td class="meaning">an F element preceded by an E element</td>
  588.     <td class="described"><a href="#adjacent-i-combinators">Indirect
  589.       adjacent combinator</a></td>
  590.     <td class="origin">3</td></tr></tbody></table>
  591. <p>The meaning of each selector is derived from the table above by
  592.  prepending "matches" to the contents of each cell of the "Meaning" column.
  593. </p><h2><a name="casesens">3. Case sensitivity</a></h2>
  594. <p>The case-sensitivity of document language element names in selectors depends
  595. on the document language. For example, in HTML, element names are
  596. case-insensitive, but in XML they are case-sensitive.
  597. </p><p>The case-sensitivity of attribute names and attribute values in attribute
  598. selectors also depends on the document language.
  599. </p><h2><a name="selector-syntax">4. Selector syntax</a></h2>
  600. <p>A&nbsp;<dfn><a name="selector">selector</a></dfn> is a chain of one or more <a href="#sequence">sequences of simple
  601. selectors</a> separated by <a href="#combinators">combinators</a>.
  602. </p><p>A&nbsp;<dfn><a name="sequence">sequence of simple selectors</a></dfn> is a chain
  603.   of <a href="#simple-selectors-dfn">simple selectors</a> that are not separated by a
  604.   <a href="#combinators">combinator</a>. It always begins with a <a href="#type-selectors">type selector</a> or a <a href="#universal-selector">universal
  605.   selector</a>. No other type selector or universal selector is allowed in the
  606.   sequence.
  607. </p><p>A&nbsp;<dfn><a name="simple-selectors-dfn"></a><a href="#simple-selectors">simple selector</a></dfn> is either a <a href="#type-selectors">type selector</a>, <a href="#universal-selector">universal selector</a>, <a href="#attribute-selectors">attribute selector</a>, <a href="#id-selectors">ID
  608.   selector</a>, <a href="#content-selectors">content selector</a>, or <a href="#pseudo-classes">pseudo-class</a>. One <a href="#pseudo-elements">pseudo-element</a> may be appended to the last sequence
  609.   of simple selectors.
  610. </p><p><dfn>Combinators</dfn> are: white space, "greater-than sign" (<code>&gt;</code>),
  611.   "plus sign" (<code>+</code>) and "tilde" (<code>~</code>).
  612.   White space may appear between a combinator and the simple selectors around
  613.   it. <a name="whitespace"></a>Only the characters "space" (Unicode code 32), "tab"
  614.   (9), "line feed" (10), "carriage return" (13), and "form feed" (12) can occur
  615.   in white space. Other space-like characters, such as "em-space" (8195) and "ideographic
  616.  space" (12288), are never part of white space.
  617. </p><p>The elements of the document tree represented by a selector are called <dfn><a name="subject"></a>subjects
  618.   of the selector</dfn>. A selector consisting of a single sequence of simple
  619.   selectors represents any element satisfying its requirements. Prepending another
  620.   sequence of simple selectors and a combinator to a sequence imposes additional
  621.   matching constraints, so the subjects of a selector are always a subset of the
  622.   elements represented by the rightmost sequence of simple selectors.
  623. </p><p><strong><em>Note</em></strong><em>: an empty selector, containing no sequence
  624.   of simple selectors and no combinator, is an <a href="#Conformance">invalid
  625.   selector</a>.</em>
  626. </p><h2><a name="grouping">5. Groups of selectors</a></h2>
  627. <p>When several selectors share the same declarations, they may be grouped into
  628. a comma-separated list.
  629. </p><div class="example">CSS example(s):
  630. <p>In this example, we condense three rules with identical declarations into
  631. one. Thus, </p><pre>h1 { font-family: sans-serif }
  632. h2 { font-family: sans-serif }
  633. h3 { font-family: sans-serif }</pre>is equivalent to: <pre>h1, h2, h3 { font-family: sans-serif }</pre></div>
  634. <p><b>Warning</b>: the equivalence is true in this example because all selectors
  635.   are valid selectors. If just one of these selectors is invalid, the entire group
  636.   of selectors is invalid thus invalidating the rule for all three heading elements,
  637.   whereas only one of the three individual heading rules would be invalid.
  638.  
  639. </p><h2><a name="simple-selectors">6. Simple selectors</a></h2>
  640. <h3><a name="type-selectors">6.1 Type selector</a></h3>
  641. <p>A&nbsp;<dfn>type selector</dfn> is the name of a document language element
  642. type. A type selector represents an instance of the element type in the document
  643. tree.
  644. </p><div class="example">Example:
  645.   <p>The following selector represents an <code>h1</code> element in the document
  646. tree: </p><pre>h1</pre></div>
  647. <h4><a name="typenmsp">6.1.1 Type selectors and Namespaces</a></h4>
  648. <p>Type selectors allow an optional namespace (<a href="#XMLNAMES">[XML-NAMES]</a>) component.
  649.   A namespace prefix that has been previously declared
  650.   may be prepended to the element name separated by the namespace separator
  651.   "vertical bar" (<code>|</code>). The namespace component may be left
  652.   empty to indicate that the selector is only to represent elements with no declared
  653.   namespace. Furthermore, an asterisk may be used for the namespace prefix, indicating
  654.   that the selector represents elements in any namespace (including elements
  655.   with no namespace). Element type selectors that have no namespace component
  656.   (no namespace separator), represent elements without regard
  657.   to the element's namespace (equivalent to "<code>*|</code>") unless a default
  658.  namespace has been declared. In that case, the selector will represent only
  659.  elements in the default namespace.
  660. </p><p>Note : a type selector containing a namespace prefix that has not been previously
  661. declared is an <a href="#Conformance">invalid</a> selector.
  662. The mechanism for declaring a namespace prefix is left up to the language
  663. implementing <span class="modulename">Selectors</span>.
  664. In CSS, such a mechanism is defined in the General Syntax module.
  665.  
  666. <!--<p>An alternative approach would be to define element type selectors that have
  667.  no namespace component to match only elements that have no namespace (unless
  668.  a default namespace has been declared in the CSS). This would make the selector
  669.  "<code>h1</code>" equivalent to the selector "<code>|h1</code>" as opposed to
  670.  "<code>*|h1</code>". The downside to this approach is that legacy style sheets
  671.  (those written without any namespace constructs) will fail to match in all XML
  672.  documents where namespaces are used throughout, e.g. all XHTML documents. -->
  673. </p><p>It should be noted that if a namespace prefix used in a selector has not been
  674.  previously declared, then the selector must be considered invalid and the entire
  675.  style rule will be ignored in accordance with the <a href="#Conformance">standard
  676.  error handling rules</a>.
  677. </p><p>It should further be noted that in a namespace aware client, element type
  678. selectors will only match against the <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> of the
  679. element's <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
  680. name</a>. See <a href="#downlevel">below</a>
  681. for notes about matching behaviors in down-level clients.
  682. </p><p>In summary:
  683. </p><dl>
  684.   <dt><code>ns|E</code>
  685.   </dt><dd>elements with name E in namespace ns
  686.   </dd><dt><code>*|E</code>
  687.   </dt><dd>elements with name E in any namespace, including those without any
  688.   declared namespace
  689.   </dd><dt><code>|E</code>
  690.   </dt><dd>elements with name E without any declared namespace
  691.   </dd><dt><code>E</code>
  692.   </dt><dd>if no default namespace has been specified, this is equivalent to *|E.
  693.   Otherwise it is equivalent to ns|E where ns is the default namespace. </dd></dl>
  694. <div class="example">
  695. <p>CSS examples:
  696.   </p><pre>@namespace foo url(http://www.example.com);
  697.  
  698. foo|h1 { color: blue }
  699.  
  700. foo|* { color: yellow }
  701.  
  702. |h1 { color: red }
  703.  
  704. *|h1 { color: green }
  705.  
  706. h1 { color: green }</pre>
  707.   <p>The first rule will match only <code>h1</code> elements in the "http://www.example.com"
  708.     namespace.
  709.   </p><p>The second rule will match all elements in the "http://www.example.com" namespace.
  710.  
  711. </p><p>The third rule will match only <code>h1</code> elements without any declared
  712. namespace.
  713. </p><p>The fourth rule will match <code>h1</code> elements in any namespace (including
  714. those without any declared namespace).
  715. </p><p>The last rule is equivalent to the fourth rule because no default namespace
  716. has been defined.</p></div>
  717. <h3><a name="universal-selector">6.2 Universal selector</a> </h3>
  718. <p>The&nbsp;<dfn>universal selector</dfn>, written "asterisk" (<code>*</code>),
  719.   represents the qualified name of any element type. It represents then any single
  720.   element in the document tree in any namespace (including those without any declared
  721.   namespace) if no default namespace has been specified. If a default namespace
  722.   has been specified, see <a href="#univnmsp">Universal selector and Namespaces</a> below.
  723. </p><p>If the universal selector is not the only component of a sequence of simple
  724. selectors, the <code>*</code> may be omitted. For example:
  725. </p><div class="example">
  726. <ul>
  727.   <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,
  728.   </li><li><code>*.warning</code> and <code>.warning</code> are equivalent,
  729.   </li><li><code>*#myid</code> and <code>#myid</code> are equivalent. </li></ul></div>
  730. <p><b>Note</b>: it is recommended that the <code>*</code>, representing the
  731. universal selector, not be omitted.
  732. </p><h4><a name="univnmsp">6.2.1 Universal selector and Namespaces</a></h4>
  733. <p>The universal selector allows an optional namespace component.
  734. </p><dl>
  735.   <dt><code>ns|*</code>
  736.   </dt><dd>all elements in namespace ns
  737.   </dd><dt><code>*|*</code>
  738.   </dt><dd>all elements
  739.   </dd><dt><code>|*</code>
  740.   </dt><dd>all elements without any declared namespace
  741.   </dd><dt><code>*</code>
  742.   </dt><dd>if no default namespace has been specified, this is equivalent to *|*.
  743.   Otherwise it is equivalent to ns|* where ns is the default namespace. </dd></dl>
  744. <p>Note: a universal selector containing a namespace prefix that has not been
  745.  previously declared is an <a href="#Conformance">invalid</a> selector.
  746.  The mechanism for declaring a namespace prefix is left up to the language
  747.  implementing <span class="modulename">Selectors</span>.
  748.  In CSS, such a mechanism is defined in the General Syntax module.
  749.  
  750. </p><h3><a name="attribute-selectors">6.3 Attribute selectors</a></h3>
  751. <p><span class="propernoun">Selectors</span> allow the representation of an element's attributes.
  752.  
  753. </p><h4><a name="attribute-representation">6.3.1 Attribute presence and values
  754. selectors</a></h4>
  755. <p>CSS2 introduced four attribute selectors:
  756. </p><dl>
  757.  <dt><code>[att]</code>
  758.  </dt><dd>Represents the <code>att</code> attribute, whatever the value of the
  759.  attribute.
  760.  </dd><dt><code>[att=val]</code>
  761.  </dt><dd>Represents the <code>att</code> attribute with value exactly "val".
  762.  </dd><dt><code>[att~=val]</code>
  763.  </dt><dd>Represents the <code>att</code> attribute whose value is a space-separated list of words,
  764.  one of which is exactly "val". If this selector is used, the
  765.  words in the value must not contain spaces (since they are separated by
  766.  spaces).
  767.  </dd><dt><code>[att|=val]</code>
  768.  </dt><dd>Represents the <code>att</code> attribute, its value either being exactly "val" or
  769.  beginning with "val" immediately followed by "-".
  770.  This is primarily intended to allow language subcode matches
  771.  (e.g., the <code>hreflang</code> attribute on the <code>link</code> element in HTML)
  772.  as described in RFC 3066 (<a class="noxref" href="#rfc3066" rel="biblioentry">[RFC3066]</a>).
  773.   Note: for <code>lang</code> (or <code>xml:lang</code>) language subcode matching,
  774.   please see <a href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.
  775.  
  776. </dd></dl>
  777. <p>Attribute values must be identifiers or strings. The case-sensitivity of
  778. attribute names and values in selectors depends on the document language.
  779. </p><div class="example">Examples:
  780.  <p>For example, the following attribute selector represents an <code>h1</code>
  781. element that carries the <code>title</code> attribute, whatever its value: </p><pre>h1[title]</pre>
  782.  <p>In the following example, the selector represents a <code>span</code> element
  783. whose <code>class</code> attribute has exactly the value "example": </p><pre>span[class=example]</pre>
  784.  Multiple attribute selectors can be used to represent several attributes of
  785.  an element, or several conditions on the same attribute.
  786.  <p>Here, the selector represents a <code>span</code> element whose <code>hello</code>
  787. attribute has exactly the value "Cleveland" and whose <code>goodbye</code> attribute
  788. has exactly the value "Columbus": </p><pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
  789.  <p>The following selectors illustrate the differences between "=" and "~=".
  790.    The first selector will represent, for example, the value "copyright copyleft
  791.    copyeditor" on a <code>rel</code> attribute. The second selector will only
  792.    represent an <code>a</code> element with an <code>href</code> attribute having
  793.    the exact value "http://www.w3.org/".
  794.  </p><pre>a[rel~="copyright"]
  795. a[href="http://www.w3.org/"]</pre>
  796.  <p>The following selector represents a <code>link</code> element whose
  797.  <code>hreflang</code> attribute is exactly "fr".
  798.  </p><pre>link[hreflang=fr]</pre>
  799.  <p>The following selector represents a <code>link</code> element for which the
  800.    values of the <code>hreflang</code> attribute begins with "en", including
  801.    "en", "en-US", and "en-cockney":
  802.  </p><pre>link[hreflang|="en"]</pre>
  803.  <p>Similarly, the following selectors represents a <code>DIALOGUE</code> element
  804. whenever it has one of two different values for an attribute <code>character</code>:
  805. </p><pre>DIALOGUE[character=romeo]&nbsp;
  806.  
  807. DIALOGUE[character=juliet]</pre></div>
  808. <h4><a name="attribute-substrings"></a>6.3.2 Substring matching attribute
  809. selectors</h4>
  810. <p>Three additional attribute selectors are provided
  811. for matching substrings in the value of an attribute:
  812. </p><dl>
  813.  <dt><code>[att^=val]</code>
  814.  </dt><dd>Represents the <code>att</code> attribute whose value begins with
  815.  the prefix "val"
  816.  </dd><dt><code>[att$=val]</code>
  817.  </dt><dd>Represents the <code>att</code> attribute whose value ends with the
  818.  suffix "val"
  819.  </dd><dt><code>[att*=val]</code>
  820.  </dt><dd>Represents the <code>att</code> attribute whose value contains at least
  821.  one instance of the substring "val" </dd></dl>
  822. <p>Attribute values must be identifiers or strings. The case-sensitivity of
  823. attribute names in selectors depends on the document language.
  824. </p><p>Example:
  825. </p><p>The following selector represents an HTML <code>object</code>, referencing an
  826. image:</p><pre>object[type^="image/"]
  827. </pre>
  828. <p>The following selector represents an HTML anchor <code>a</code> with an
  829.  <code>href</code> attribute whose value ends with ".html".
  830. </p><pre>a[href$=".html"]</pre>
  831. <p>The following selector represents a HTML paragraph with a <code>title</code>
  832. attribute whose value contains the substring "hello"</p><pre>p[title*="hello"] </pre>
  833. <h4><a name="attrnmsp">6.3.3 Attribute selectors and Namespaces</a></h4>
  834. <p>Attribute selectors allow an optional namespace component to the attribute
  835.  name. A namespace prefix that has been previously declared may be prepended
  836.  to the attribute name separated by the namespace separator
  837.  "vertical bar" (<code>|</code>). In keeping with the Namespaces in
  838.  the XML recommendation, default namespaces do not apply to attributes, therefore
  839.  attribute selectors without a namespace component apply only to attributes that
  840.  have no declared namespace (equivalent to "<code>|attr</code>"). An asterisk
  841.  may be used for the namespace prefix indicating that the selector is to match
  842.  all attribute names without regard to the attribute's namespace.
  843. </p><p>Note : an attribute
  844.  selector with an attribute name containing a namespace prefix that has
  845.  not been previously declared is an <a href="#Conformance">invalid</a> selector.
  846.  The mechanism for declaring a namespace prefix is left up to the language
  847.  implementing <span class="modulename">Selectors</span>.
  848.  In CSS, such a mechanism is defined in the General Syntax module.
  849.  
  850. </p><p>CSS examples:
  851. </p><div class="example">
  852.   <pre>@namespace foo "http://www.example.com";
  853.  
  854. [foo|att=val] { color: blue }
  855.  
  856. [*|att] { color: yellow }
  857.  
  858. [|att] { color: green }
  859.  
  860. [att] { color: green }</pre>
  861.   The first rule will match only elements with the attribute <code>att</code>
  862.   in the "http://www.example.com" namespace with the value "val".
  863.   <p>The second rule will match only elements with the attribute <code>att</code>
  864. regardless of the namespace of the attribute (including no declared namespace).
  865. </p><p>The last two rules are equivalent and will match only elements with the
  866. attribute <code>att</code> where the attribute is not declared to be in a
  867. namespace.</p></div>
  868. <h4><a name="def-values">6.3.4 Default attribute values in DTDs</a></h4>
  869. <p>Attribute selectors represent explicitly set attribute values in the document
  870.   tree. Default attribute values may be defined in a DTD or elsewhere.
  871.   <span class="propernoun">Selectors</span> should be designed so that they work
  872.   even if the default values are not included in the document tree.
  873. </p><div class="example">Examples:
  874.   <p>For example, consider an element <code>EXAMPLE</code> with an attribute
  875. <code>notation</code> that has a default value of "decimal". The DTD fragment
  876. might be </p><pre>&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"&gt;</pre>
  877.   If the selectors represent an <code>EXAMPLE</code> element when the value of
  878.   the attribute is explicitly set:
  879.   <pre>EXAMPLE[notation=decimal]
  880. EXAMPLE[notation=octal]</pre>
  881.   then to represent only the case where this attribute is set by default, and
  882.   not explicitly, the following selector might be used:
  883.   <pre>EXAMPLE:not([notation])</pre>
  884. </div>
  885. <h3><a name="class-html">6.4 Class selectors</a></h3>
  886. <p>Working with HTML, authors may use the period (<code>.</code>) notation as
  887.   an alternative to the <code>~=</code> notation when representing the <code>class</code>
  888.   attribute. Thus, for HTML, <code>div.value</code> and <code>div[class~=value]</code>
  889.   have the same meaning. The attribute value must immediately follow the "period"
  890.   (<code>.</code>). Note: UAs may apply selectors using the period (.) notation
  891.   in XML documents if the UA has namespace specific knowledge that allows it to
  892.   determine which attribute is the "class" attribute for the respective
  893.   namespace. One such example of namespace specific knowledge is the prose in
  894.   the specification for a particular namespace (e.g. SVG 1.0 [<a href="#SVG">SVG</a>]
  895.   describes the <a href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
  896.   "class" attribute</a> and how a UA should interpret it, and similarly
  897.   MathML 1.01 [<a href="#MATH">MATH</a>] describes the <a href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
  898.   "class" attribute</a>.)
  899. </p><p>
  900. </p><div class="example">Examples:
  901.   <p>For example, we can represent an arbitrary element with
  902. <code>class~="pastoral"</code> as follows: </p><pre>*.pastoral</pre>or just <pre>.pastoral</pre>
  903.   The following selector represents an <code>h1</code> element with <code>class~="pastoral"</code>:
  904.   <pre>h1.pastoral</pre>
  905.   <p>For example, the following selector represents a <code>p</code> element whose
  906. <code>class</code> attribute has been assigned a list of space-separated values that
  907. includes "pastoral" and "marine": </p><pre>p.pastoral.marine</pre>
  908. <p>It is fully identical to:</p><pre>p.marine.pastoral</pre>
  909.   <p>This selector represents for example a <code>p</code> with <code>class="pastoral
  910.    blue aqua marine"</code> or <code>class="marine blue pastoral aqua" </code>but
  911.     not <code>class="pastoral blue"</code>.
  912. </p></div>
  913. <h3><a name="id-selectors">6.5 ID selectors</a></h3>
  914. <p>Document languages may contain attributes that are declared to be of type ID.
  915.   What makes attributes of type ID special is that no two such attributes can
  916.   have the same value in a document, regardless of the type of the elements that
  917.   carry them; whatever the document language, an ID typed attribute can be used
  918.   to uniquely identify its element. In HTML all ID attributes are named "id";
  919.   XML applications may name ID attributes differently, but the same restriction
  920.   applies.
  921. </p><p>An ID typed attribute of a document language allows authors to assign an identifier
  922.   to one element instance in the document tree. W3C ID selectors represent an
  923.   element instance based on its identifier. An ID selector contains a "number
  924.  sign" (#) immediately followed by the ID value.
  925. </p><div class="example">Examples:
  926.   <p>The following ID selector represents an <code>h1</code> element whose ID typed
  927.     attribute has the value "chapter1":
  928.   </p><pre>h1#chapter1</pre>
  929.   <p>The following ID selector represents any element whose ID typed attribute
  930.     has the value "chapter1":
  931.   </p><pre>#chapter1</pre>
  932.   The following selector represents any element whose ID typed attribute has the
  933.   value "z98y".
  934.   <pre>*#z98y</pre></div>
  935. <div class="note"><i><b>Note.</b> In XML 1.0 <a class="noxref" href="http://www.w3.org/TR/REC-CSS2/refs.html#ref-XML10" rel="biblioentry">[XML10]</a>, the information about which attribute contains an
  936.   element's IDs is contained in a DTD or a schema. When parsing XML, UAs do not
  937.  always read the DTD, and thus may not know what the ID of an element is
  938.  (though a UA may have namespace specific knowledge that allows it to determine
  939.  which attribute is the ID attribute for that namespace). If
  940.  a style sheet designer knows or suspects that a UA may not know what the ID of an
  941.  element is, he should use normal attribute selectors instead:
  942.  <code>[name=p371]</code> instead of <code>#p371</code>.
  943.  Elements in XML 1.0 documents without a DTD do not have IDs at all.</i></div>
  944. <h3><a name="pseudo-classes">6.6 Pseudo-classes</a></h3>
  945. <p>The pseudo-class concept is introduced to permit selection based on information
  946.  that lies outside of the document tree or that cannot be expressed using the
  947.  other simple selectors.
  948. </p><p>A pseudo-class always contains a "colon" (<code>:</code>) followed
  949.  by the name of the pseudo-class and optionally by a value between parentheses.
  950.  
  951. </p><p>Pseudo-classes are allowed in all sequences of simple selectors contained in
  952.  a selector. Pseudo-classes are allowed anywhere in sequences of simple selectors,
  953.  after the leading type selector or universal selector (possibly omitted). Pseudo-class
  954.  names are case-insensitive. Some pseudo-classes are mutually exclusive, while
  955.  others can be applied simultaneously to the same element. Pseudo-classes may
  956.  be dynamic, in the sense that an element may acquire or lose a pseudo-class
  957.  while a user interacts with the document.
  958. </p><h4><a name="dynamic-pseudos">6.6.1 Dynamic pseudo-classes</a></h4>
  959. <p>Dynamic pseudo-classes classify elements on characteristics other than their
  960.  name, attributes or content, in principle characteristics that cannot be deduced
  961.  from the document tree.
  962. </p><p>Dynamic pseudo-classes do not appear in the document source or document tree.
  963.  
  964. </p><h5>The&nbsp;<a name="link">link pseudo-classes: :link and :visited</a></h5>
  965. <p>User agents commonly display unvisited links differently from previously
  966. visited ones. <span class="modulename">Selectors</span> provides the pseudo-classes <code>:link</code> and
  967. <code>:visited</code> to distinguish them:
  968. </p><ul>
  969.  <li>The <code>:link</code> pseudo-class applies for links that have not yet been
  970.  visited.
  971.  </li><li>The <code>:visited</code> pseudo-class applies once the link has been visited
  972.  by the user. </li></ul>
  973. <div class="note"><i><b>Note.</b> After some amount of time, user agents may
  974. choose to return a visited link to the (unvisited) ':link' state.</i></div>
  975. <p>The two states are mutually exclusive.
  976. </p><div class="example">Example:
  977.  <p>The following selector represents links carrying class <code>external</code> and
  978. already visited: </p><pre>a.external:visited</pre></div>
  979. <h5>The&nbsp;<a name="useraction-pseudos">user action pseudo-classes :hover,
  980. :active, and :focus</a></h5>
  981. <p>Interactive user agents sometimes change the rendering in response to user
  982. actions. <span class="modulename">Selectors</span> provides three pseudo-classes for the selection of an
  983. element the user is acting on.
  984. </p><ul>
  985.  <li>The <code>:hover</code> pseudo-class applies while the user designates an
  986.  element (with some pointing device), but does not activate it. For example, a
  987.  visual user agent could apply this pseudo-class when the cursor (mouse
  988.  pointer) hovers over a box generated by the element. User agents not
  989.  supporting <a href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
  990.  media</a> do not have to support this pseudo-class. Some conforming user
  991.  agents supporting <a href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
  992.  media</a> may not be able to support this pseudo-class (e.g., a pen device).
  993.  </li><li>The <code>:active</code> pseudo-class applies while an element is being
  994.  activated by the user. For example, between the times the user presses the
  995.  mouse button and releases it.
  996.  </li><li>The <code>:focus</code> pseudo-class applies while an element has the focus
  997.  (accepts keyboard or mouse events, or other forms of input). </li></ul>
  998. <p>There may be document language or implementation specific limits on which elements can become
  999. <code>:active</code> or acquire <code>:focus</code>.
  1000. <!--
  1001. <p>Only elements whose 'user-input' property (see <a
  1002. href="#UI-WD">[UI]</a>) has the value of
  1003. "enabled" can become <code>:active</code> or acquire <code>:focus</code>. -->
  1004. </p><p>These pseudo-classes are not mutually exclusive. An element may match several
  1005. of them at the same time.
  1006. </p><div class="example">Examples:
  1007.  <pre>a:link&nbsp;&nbsp;&nbsp; /* unvisited links */
  1008. a:visited /* visited links&nbsp;&nbsp; */
  1009. a:hover&nbsp;&nbsp; /* user hovers&nbsp;&nbsp;&nbsp;&nbsp; */
  1010. a:active&nbsp; /* active links&nbsp;&nbsp;&nbsp; */</pre>
  1011.  <p>An example of combining dynamic pseudo-classes: </p><pre>a:focus
  1012. a:focus:hover</pre>
  1013.  <p>The last selector matches <code>a</code> elements that are in pseudo-class
  1014.    :focus and in pseudo-class :hover.
  1015. </p></div>
  1016. <div class="note"><i><b>Note.</b> An element can be both ':visited' and ':active'
  1017. (or ':link' and ':active').</i></div>
  1018. <h4><a name="target-pseudo">6.6.2 The target pseudo-class :target</a></h4>
  1019. <p>Some URIs refer to a location within a resource. This kind of URI ends with
  1020.  a "number sign" (<code>#</code>) followed by an anchor identifier
  1021.  (called the fragment identifier).
  1022. </p><p>URIs with fragment identifiers link to a certain element within the document,
  1023. known as the target element. For instance, here is a URI pointing to an anchor
  1024. named section_2 in a HTML document:
  1025. </p><pre>http://example.com/html/top.html#section_2</pre>
  1026. <p>A target element can be represented by the <code>:target</code> pseudo-class:
  1027.  
  1028. </p><pre>p.note:target</pre>
  1029. <p>represents a <code>p</code> of class note that is the target element of the
  1030.  referring URI.
  1031. </p><div class="example">CSS example of use of the <code>:target</code> pseudo-class: <pre>*:target { color : red }
  1032.  
  1033. *:target::before { content : url(target.png) }</pre></div>
  1034. <h4><a name="lang-pseudo">6.6.3 The language pseudo-class :lang</a></h4>
  1035. <p>If the document language specifies how the human language of an element is
  1036.  determined, it is possible to write selectors that represent an element based
  1037.  on its language. For example, in HTML <a href="#html40" rel="biblioentry">[HTML4.01]</a>, the language is determined by a combination of
  1038.  the <code>lang</code> attribute, the <code>meta</code> element, and possibly
  1039.  by information from the protocol (such as HTTP headers). XML uses an attribute
  1040.  called <code>xml:lang</code>, and there may be other document language-specific
  1041.  methods for determining the language.
  1042. </p><p>The pseudo-class <code>:lang(C)</code> represents an element that is in language
  1043.  C. Here C is a language code as specified in HTML 4.01 <a href="#html40" rel="biblioentry">[HTML4.01]</a> and RFC 3066 <a href="#rfc3066" rel="biblioentry">[RFC3066]</a>.
  1044. </p><div class="example">Examples:
  1045.  <p>The two following selectors represent an HTML document that is in Belgian
  1046.    French or German. The two next selectors represent <code>q</code> quotations
  1047.    in an arbitrary element in Belgian French or German.
  1048.  </p><pre>html:lang(fr-be)
  1049. html:lang(de)
  1050. :lang(fr-be) &gt; q
  1051. :lang(de) &gt; q</pre>
  1052. </div>
  1053. <h4><a name="UIstates">6.6.4 The UI element states pseudo-classes</a></h4>
  1054. <h5><a name="enableddisabled">The :enabled and :disabled pseudo-classes</a></h5>
  1055. <p>The purpose of the <code>:enabled</code> pseudo-class is to allow authors to
  1056.  customize the look of user interface elements which are enabled - which the
  1057.  user can select/activate in some fashion (e.g. clicking on a button with a mouse).
  1058.  There is a need for such a pseudo-class because there is no way to programmatically
  1059.  specify the default appearance of say, an enabled <code>input</code> element
  1060.  without also specifying what it would look like when it was disabled.
  1061. </p><p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the author to specify
  1062. precisely how a disabled or inactive user interface element should look.
  1063. </p><p>It should be noted that most elements will be neither enabled nor disabled.
  1064. An element is enabled if the user can either activate it or transfer the focus
  1065. to it. An element is disabled if it could be enabled, but the user cannot
  1066. presently activate it or transfer focus to it.
  1067. </p><h5><a name="checked">The :checked pseudo-class</a></h5>
  1068. <p><!--The <code>:checked</code> pseudo-class only applies to elements which are
  1069. 'user-input: enabled' or 'user-input : disabled' (see [UI] for the 'user-input'
  1070. property). -->Radio and checkbox elements can be toggled by the user. Some menu
  1071. items are "checked" when the user selects them. When such elements are toggled
  1072. "on" the <code>:checked</code> pseudo-class applies. The <code>:checked</code>
  1073. pseudo-class initially applies to such elements that have the HTML4
  1074. <code>selected</code> attribute as described in <a href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
  1075. 17.2.1 of HTML4</a>, but of course the user can toggle "off" such elements in
  1076. which case the <code>:checked</code> pseudo-class would no longer apply. While the
  1077. <code>:checked</code> pseudo-class is dynamic in nature, and is altered by user
  1078. action, since it can also be based on the presence of the semantic HTML4
  1079. <code>selected</code> attribute, it applies to all media.
  1080. </p><h5><a name="indeterminate">The :indeterminate pseudo-class</a></h5>
  1081. <p><!--The <code>:indeterminate</code> pseudo-class only applies to elements which are
  1082. 'user-input: enabled' or 'user-input: disabled' (see <a
  1083. href="#UI-WD">[UI]</a> for the 'user-input'
  1084. property). -->Radio and checkbox elements can be toggled by the user, but are
  1085. sometimes in an indeterminate state, neither checked nor unchecked. This can be
  1086. due to an element attribute, or DOM manipulation. The <code>:indeterminate</code>
  1087. pseudo-class applies to such elements. While the <code>:indeterminate</code>
  1088. pseudo-class is dynamic in nature, and is altered by user action, since it can
  1089. also be based on the presence of an element attribute, it applies to all media.
  1090.  
  1091. </p><p>Components of a radio-group initialized with no pre-selected choice are an
  1092. example of :indeterminate state.
  1093. </p><h4><a name="structural-pseudos">6.6.5 Structural pseudo-classes</a></h4>
  1094. <p><span class="modulename">Selectors</span> introduces the concept of&nbsp;<dfn>structural
  1095. pseudo-classes</dfn> to permit selection based on extra information that lies in
  1096. the document tree but cannot be represented by other simple selectors or
  1097. combinators.
  1098. </p><p>Note that standalone PCDATA are not counted when calculating the position of
  1099. an element in the list of children of its parent. When calculating the position
  1100. of an element in the list of children of its parent, the index numbering starts
  1101. at 1.
  1102. </p><h5><a name="root-pseudo">:root pseudo-class</a></h5>
  1103. <p>The <code>:root</code> pseudo-class represents an element that is the root
  1104.  of the document. In HTML 4, this is the <code>HTML</code> element. In XML, it
  1105.  is whatever is appropriate for the DTD or schema and namespace for that XML
  1106.  document.
  1107. </p><h5><a name="nth-child-pseudo">:nth-child() pseudo-class</a></h5>
  1108. <p>The <code>:nth-child(an+b)</code> pseudo-class notation represents an element
  1109.  that has an+b-1 siblings <strong>before</strong> it in the document tree, for
  1110.  a given positive integer or zero value of n. In other words, this matches the
  1111.  bth child of an element after all the children have been split into groups of
  1112.  a elements each. For example, this allows the selectors to address every other
  1113.  row in a table, and could be used, for example, to alternate the color of paragraph
  1114.  text in a cycle of four. The a and b values must be zero, negative integers
  1115.  or positive integers. The index of the first child of an element is 1.
  1116. </p><p>In addition to this, <code>:nth-child()</code> can take 'odd' and 'even' for
  1117. argument. 'odd' has the same signification as 2n+1, and 'even' has the same
  1118. signification as 2n.
  1119. </p><div class="example">Examples:
  1120. <pre>tr:nth-child(2n+1) /* represents every odd row of a HTML table */
  1121. tr:nth-child(odd)  /* same */
  1122. tr:nth-child(2n)   /* represents every even row of a HTML table */
  1123. tr:nth-child(even) /* same */
  1124.  
  1125. /* Alternate paragraph colours in CSS */
  1126. p:nth-child(4n+1) { color: navy; }
  1127. p:nth-child(4n+2) { color: green; }
  1128. p:nth-child(4n+3) { color: maroon; }
  1129. p:nth-child(4n+4) { color: purple; }</pre>
  1130. </div>
  1131. <p>When a=0, no repeating is used, so for example <code>:nth-child(0n+5)</code>
  1132. matches only the fifth child. When a=0, the a part need not be included, so the
  1133. syntax simplifies to <code>:nth-child(b)</code> and the last example simplifies
  1134. to <code>:nth-child(5)</code>.
  1135. </p><div class="example">
  1136. <pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
  1137. foo:nth-child(1)      /* same */</pre>
  1138. </div>
  1139. <p>When a=1, the number may be omitted from the rule,
  1140. so the following examples are equivalent:
  1141. </p><div class="example">
  1142. <pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
  1143. bar:nth-child(n+0)    /* same */
  1144. bar:nth-child(n)      /* same */
  1145. bar                   /* same but lower specificity (0,0,1) */</pre>
  1146. </div>
  1147. <p>If b=0, then every a-th element is picked:
  1148. </p><div class="example">
  1149. <pre>tr:nth-child(2n) /* represents every even row of a HTML table */</pre>
  1150. </div>
  1151. <p>If both a and b are equal to zero, the pseudo-class represents no element in
  1152. the document tree.
  1153. </p><p>The value a can be negative, but only the positive values of an+b, for n&gt;=
  1154.  0, may represent an element in the document tree, of course:
  1155. </p><div class="example">
  1156. <pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
  1157. </div>
  1158. <h5><a name="nth-last-child-pseudo">:nth-last-child() pseudo-class</a></h5>
  1159. <p>The <code>:nth-last-child(an+b)</code> pseudo-class notation represents an
  1160. element that has an+b-1 siblings <strong>after</strong> it in the document tree,
  1161. for a given positive integer or zero value of n. See <code>:nth-child()</code>
  1162. pseudo-class for the syntax of its argument. It also accepts the 'even' and
  1163. 'odd' values for argument.
  1164. </p><div class="example">Examples: <pre>tr:nth-last-child(-n+2)    /* represents the two last rows of a HTML table */
  1165.  
  1166. foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
  1167.                              counting from the last one */</pre></div>
  1168. <h5><a name="nth-of-type-pseudo">:nth-of-type() pseudo-class</a></h5>
  1169. <p>The <code>:nth-of-type(an+b)</code> pseudo-class notation represents an element
  1170. that has an+b-1 siblings with the same element name <strong>before</strong> it
  1171. in the document tree, for a given zero or positive integer value of n. In other
  1172. words, this matches the bth child of that type after all the children of that
  1173. type have been split into groups of a elements each. See
  1174. <code>:nth-child()</code> pseudo-class for the syntax of its argument. It also
  1175. accepts the 'even' and 'odd' values for argument.
  1176. </p><div class="example">For example, this allows in CSS to alternate the position of
  1177. floated images: <pre>img:nth-of-type(2n+1) { float: right; }
  1178. img:nth-of-type(2n) { float: left; }
  1179. </pre></div>
  1180. <h5><a name="nth-last-of-type-pseudo">:nth-last-of-type() pseudo-class</a></h5>
  1181. <p>The <code>:nth-last-of-type(an+b)</code> pseudo-class notation represents an
  1182. element that has an+b-1 siblings with the same element name
  1183. <strong>after</strong> it in the document tree, for a given zero or positive
  1184. integer value of n. See <code>:nth-child()</code> pseudo-class for the syntax of
  1185. its argument. It also accepts the 'even' and 'odd' values for argument.
  1186. </p><div class="example">For example, to represent all <code>h2</code> children of a
  1187. XHTML <code>body</code> except the first and last, one would use the following
  1188. selector: <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
  1189. <p>In this case, one could also use <code>:not()</code>, although the selector
  1190. ends up being just as long:</p><pre>body &gt; h2:not(:first-of-type):not(:last-of-type) </pre></div>
  1191. <h5><a name="first-child-pseudo">:first-child pseudo-class</a></h5>
  1192. <p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
  1193. represents an element that is the first child of some other element.
  1194. </p><div class="example">Examples:
  1195.  <p>In the following example, the selector represents a <code>p</code> element that
  1196. is the first child of a <code>div</code> element: </p><pre>div &gt; p:first-child</pre>This selector can represent the <code>p</code>
  1197. inside the <code>div</code> of the following fragment: <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
  1198. &lt;div class="note"&gt;
  1199. &nbsp;&nbsp; &lt;p&gt; The first P inside the note.&lt;/p&gt;
  1200. &lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
  1201. fragment: <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
  1202. &lt;div class="note"&gt;
  1203. &nbsp;&nbsp; &lt;h2&gt;Note&lt;/h2&gt;
  1204. &nbsp;&nbsp; &lt;p&gt; The first P inside the note.&lt;/p&gt;
  1205. &lt;/div&gt;</pre>The following two selectors are equivalent: <pre>* &gt; a:first-child&nbsp;&nbsp; /* a is first child of any element */
  1206. a:first-child&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Same */</pre></div>
  1207. <h5><a name="last-child-pseudo">:last-child pseudo-class</a></h5>
  1208. <p>Same as <code>:nth-last-child(1)</code>.The <code>:last-child</code> pseudo-class
  1209. represents an element that is the last child of some other element.
  1210. </p><p>The following selector represents a list item <code>li</code> that is the last
  1211. child of an ordered list <code>ol</code>.
  1212. </p><div class="example">Example:
  1213. <pre>ol &gt; li:last-child</pre></div>
  1214. <h5><a name="first-of-type-pseudo">:first-of-type pseudo-class</a></h5>
  1215. <p>Same as <code>:nth-of-type(1)</code>.The <code>:first-of-type</code> pseudo-class
  1216. represents an element that is the first sibling of its type in the list of
  1217. children of its parent element.
  1218. </p><div class="example">Example:
  1219. <p>The following selector represents a definition title <code>dt</code> inside a
  1220. definition list <code>dl</code>, this <code>dt</code> being the first of its type in
  1221. the list of children of its parent element. </p><pre>dl dt:first-of-type</pre>It is a valid description for the first two
  1222. <code>dt</code> in the following example but not for the third one: <pre>&lt;dl&gt;&lt;dt&gt;gigogne&lt;/dt&gt;
  1223. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dd&gt;&lt;dl&gt;&lt;dt&gt;fus&amp;eacute;e&lt;/dt&gt;
  1224. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dd&gt;multistage rocket&lt;/dd&gt;
  1225. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dt&gt;table&lt;/dt&gt;
  1226. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dd&gt;nest of tables&lt;/dd&gt;
  1227. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/dl&gt;&lt;/dd&gt;
  1228. &lt;/dl&gt;</pre></div>
  1229. <h5><a name="last-of-type-pseudo">:last-of-type pseudo-class</a></h5>
  1230. <p>Same as <code>:nth-last-of-type(1)</code>.The <code>:last-of-type</code>
  1231. pseudo-class represents an element that is the last sibling of its type in the
  1232. list of children of its parent element.
  1233. </p><div class="example">Example:
  1234. <p>The following selector represents the last data cell <code>td</code> of a table
  1235. row. </p><pre>tr &gt; td:last-of-type</pre></div>
  1236. <h5><a name="only-child-pseudo">:only-child pseudo-class</a></h5>
  1237. <p>Represents an element that has no siblings. Same as
  1238. <code>:first-child:last-child</code> or
  1239. <code>:nth-child(1):nth-last-child(1)</code>, but with a lower specificity.
  1240. </p><h5><a name="only-of-type-pseudo">:only-of-type pseudo-class</a></h5>
  1241. <p>Represents an element that has no siblings with the same element name. Same
  1242. as <code>:first-of-type:last-of-type</code> or
  1243. <code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower specificity.
  1244.  
  1245. </p><h5><a name="empty-pseudo"></a>:empty pseudo-class</h5>
  1246. <p>The <code>:empty</code> pseudo-class represents an element that has no children
  1247.  at all, including possibly empty text nodes, from a DOM point of view.
  1248. </p><div class="example">Examples:
  1249. <p><code>p:empty</code> is a valid representation of the following fragment:</p><pre>&lt;p&gt;&lt;/p&gt;</pre>
  1250. <p><code>foo:empty</code> is not a valid representation for the following
  1251. fragments:</p><pre>&lt;foo&gt;bar&lt;/foo&gt;</pre><pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre><pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre></div>
  1252. <h4><a name="content-selectors">6.6.6 Content pseudo-class</a></h4>
  1253. <p>The <code>:contains("foo")</code> pseudo-class notation represents an element
  1254. whose textual contents contain the given substring. The argument of this
  1255. pseudo-class can be a string (surrounded by double quotes) or a keyword.
  1256. </p><p>Usage of the content pseudo-class is restricted to static media types (see
  1257.  <a href="#CSS2">[CSS2]</a>).
  1258. </p><p>The textual contents of a given element is determined by the concatenation of
  1259. all PCDATA contained in the element and sub-elements.
  1260. </p><div class="example">Example: <pre>p:contains("Markup")</pre>is a correct and valid, but partial, description
  1261. of: <pre>&lt;p&gt;&lt;strong&gt;H&lt;/strong&gt;yper&lt;strong&gt;t&lt;/strong&gt;ext
  1262. &nbsp;&nbsp; &lt;strong&gt;M&lt;/strong&gt;&lt;em&gt;arkup&lt;/em&gt;
  1263. &nbsp;&nbsp; &lt;strong&gt;L&lt;/strong&gt;anguage&lt;/p&gt;</pre></div>
  1264. <p>Special characters can be inserted in the argument of a content pseudo-class
  1265.  using the escape mechanism for Unicode characters and carriage returns.
  1266. </p><p><strong>Warning</strong>: the selector <code>ul:contains("chief")</code>
  1267.  will match the list <code>&lt;ul&gt;&lt;li&gt;... the greek letter chi&lt;/li&gt;&lt;li&gt;effective&lt;/li&gt;&lt;/ul&gt;</code>
  1268. </p><div><i><b>Note</b>: <code>:contains()</code> is a pseudo-class, not a pseudo-element.
  1269.  The following CSS rule applied to the HTML fragment above will not add a red
  1270.  background only to the word "Markup" but will add such a background to the whole
  1271.  paragraph.</i></div>
  1272. <pre>P:contains("Markup") { background-color : red }</pre>
  1273. <h4><a name="negation"></a>6.6.7 The negation pseudo-class</h4>
  1274. <p>The negation pseudo-class is a functional notation taking a <a href="#simple-selectors-dfn">simple selector</a>
  1275. (excluding the negation pseudo-class itself and pseudo-elements) as an argument. It
  1276. represents an element that is not represented by the argument.
  1277. </p><div class="example">
  1278.  <p>Examples:
  1279. </p><p>The following CSS selector matches all <code>button</code> elements in a HTML
  1280. document that are not disabled.</p><pre>button:not([DISABLED])</pre>
  1281. <p>The following selector represents all but <code>FOO</code> elements.</p><pre>*:not(FOO)</pre>
  1282. <p>The following group of selectors represents all elements but HTML links.</p><pre>html|*:not(:link):not(:visited)
  1283. </pre></div>
  1284. <p><strong>Note</strong>: the :not() pseudo allows useless selectors to be written.
  1285.  For instance <code>:not(*|*)</code>, which represents no element at all, or <code>foo:not(bar)</code>,
  1286.  which is equivalent to <code>foo</code> but with a higher specificity.
  1287. </p><h3><a name="pseudo-elements">7. Pseudo-elements</a></h3>
  1288. <p>Pseudo-elements create abstractions about the document tree beyond those
  1289. specified by the document language. For instance, document languages do not
  1290. offer mechanisms to access the first letter or first line of an element's
  1291. content. Pseudo-elements allow designers to refer to this otherwise inaccessible
  1292. information. Pseudo-elements may also provide designers a way to refer to
  1293. content that does not exist in the source document (e.g., the
  1294. <code>::before</code> and <code>::after</code> pseudo-elements give access to
  1295. generated content).
  1296. </p><p>A pseudo-element is made of two colons (<code>::</code>) followed by the name of
  1297. the pseudo-element.
  1298. </p><p><strong>Note</strong>: this <code>::</code> notation is introduced by the current
  1299.   document in order to establish a discrimination between pseudo-classes and pseudo-elements.
  1300.   For compatibility with existing style sheets, user agents must also accept the
  1301.   previous one-colon notation for pseudo-elements introduced in CSS levels 1 and
  1302.   2. This compatibility is not allowed for the new pseudo-elements introduced
  1303.   in CSS level 3.
  1304. </p><p>Pseudo-elements may only appear once in the sequence of simple selectors that
  1305. represents the <a href="#subject">subjects</a> of the
  1306. selector.
  1307. </p><h4><a name="first-line">7.1 The ::first-line pseudo-element</a></h4>
  1308. <p>The <code>::first-line</code> pseudo-element describes the first formatted line
  1309. of an element.
  1310. </p><p>For instance in CSS:</p><pre class="example">p::first-line { text-transform: uppercase }
  1311. </pre>
  1312. <p>The above rule means "change the letters of the first line of every paragraph
  1313. to uppercase". However, the selector <code>p::first-line</code> does not match
  1314. any real HTML element. It does match a pseudo-element that conforming user
  1315. agents will insert at the beginning of every paragraph.
  1316. </p><p>Note that the length of the first line depends on a number of factors,
  1317. including the width of the page, the font size, etc. Thus, an ordinary HTML
  1318. paragraph such as:</p><pre class="html-example">&lt;p&gt;This is a somewhat long HTML
  1319. paragraph that will be broken into several
  1320. lines. The first line will be identified
  1321. by a fictional tag sequence. The other lines
  1322. will be treated as ordinary lines in the
  1323. paragraph.&lt;/p&gt;
  1324. </pre>
  1325. <p>the lines of which happen to be rendered as follows if the style rule above applies:
  1326. </p><pre class="html-example">THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
  1327. will be broken into several lines. The first
  1328. line will be identified by a fictional tag
  1329. sequence. The other lines will be treated as
  1330. ordinary lines in the paragraph.
  1331. </pre>
  1332. <p>might be "rewritten" by user agents to include the <em>fictional tag sequence</em>
  1333. for <code>::first-line</code>. This fictional tag sequence helps to show how properties
  1334. are inherited.
  1335. </p><pre>&lt;p&gt;<b>&lt;p::first-line&gt;</b> This is a somewhat long HTML
  1336. paragraph that<b>&lt;/p::first-line&gt;</b> will be broken into several
  1337. lines. The first line will be identified
  1338. by a fictional tag sequence. The other lines
  1339. will be treated as ordinary lines in the
  1340. paragraph.&lt;/p&gt;
  1341. </pre>
  1342. <p>If a pseudo-element breaks up a real element, the desired effect can be
  1343. described by closing and then re-opening the fictional tag sequence.
  1344. Thus, if we mark up the previous paragraph with a <code>span</code> element:</p><pre>&lt;p&gt;<b>&lt;span class="test"&gt;</b> This is a somewhat<b>&lt;/span&gt;</b> long HTML
  1345. paragraph that will be broken into several
  1346. lines. The first line will be identified
  1347. by a fictional tag sequence. The other lines
  1348. will be treated as ordinary lines in the
  1349. paragraph.&lt;/p&gt;
  1350. </pre>
  1351. <p>the user agent could generate the appropriate start and end tags for the fictional tag sequence for <code>::first-line</code>.
  1352.  
  1353. </p><pre>&lt;p&gt;<b>&lt;span class="test"&gt;</b>&lt;p::first-line&gt; This is a
  1354. somewhat&lt;/p::first-line&gt;<b>&lt;/span&gt;</b>&lt;p::first-line&gt;
  1355. long HTML paragraph that&lt;/p::first-line&gt; will be broken into
  1356. several lines. The first line will be identified
  1357. by a fictional tag sequence. The other lines
  1358. will be treated as ordinary lines in the
  1359. paragraph.&lt;/p&gt;
  1360. </pre>
  1361. <p>The <code>::first-line</code> pseudo-element can only be attached to a
  1362. block-level element.
  1363. </p><p>The <code>::first-line</code> pseudo-element is similar to an inline-level
  1364. element, but with certain restrictions, depending on usage. Only the following
  1365. properties apply to a <code>::first-line</code> pseudo-element: font properties,
  1366. color properties, background properties, <span class="propinst-word-spacing">'word-spacing',</span> <span class="propinst-letter-spacing">'letter-spacing',</span> <span class="propinst-text-decoration">'text-decoration',</span> <span class="propinst-vertical-align">'vertical-align',</span> <span class="propinst-text-transform">'text-transform',</span> <span class="propinst-line-height">'line-height',</span> <span class="propinst-text-shadow">'text-shadow'</span>, and <span class="propinst-clear">'clear'.</span>
  1367. </p><h4><a name="first-letter">7.2 The ::first-letter pseudo-element</a></h4>
  1368. <p>The <code>::first-letter</code> pseudo-element describes the first formatted
  1369.   letter of an element.
  1370. </p><p>The <code>::first-letter</code> pseudo-element can be attached to all elements.
  1371.  
  1372. </p><p>The <code>::first-letter</code> pseudo-element may be used for "initial caps" and
  1373. "drop caps", which are common typographical effects. This type of initial letter
  1374. is similar to an inline-level element if its CSS 'float' property is 'none', but
  1375. with certain restrictions, depending on usage. Otherwise it is similar to a
  1376. floated element.
  1377. </p><p>These are the CSS properties that apply to <code>::first-letter</code>
  1378. pseudo-elements: font properties, color properties, background properties,
  1379. 'text-decoration', 'vertical-align' (only if 'float' is 'none'),
  1380. 'text-transform', 'line-height', margin properties, padding properties, border
  1381. properties, 'float', 'text-shadow', and 'clear'.
  1382. </p><div class="html-example">
  1383. <p>
  1384. </p><p>The following CSS2 will make a drop cap initial letter span two lines:
  1385.   </p><pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
  1386. &lt;HTML&gt;
  1387.  &lt;HEAD&gt;
  1388.   &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
  1389.   &lt;STYLE type="text/css"&gt;
  1390.    P               { font-size: 12pt; line-height: 12pt }
  1391.    P::first-letter { font-size: 200%; font-style: italic;
  1392.                      font-weight: bold; float: left }
  1393.    SPAN            { text-transform: uppercase }
  1394.   &lt;/STYLE&gt;
  1395.  &lt;/HEAD&gt;
  1396.  &lt;BODY&gt;
  1397.   &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
  1398.     in The Economist.&lt;/P&gt;
  1399.  &lt;/BODY&gt;
  1400. &lt;/HTML&gt;
  1401. </pre>
  1402. <p>This example might be formatted as follows:
  1403. </p><div class="figure">
  1404. <p><img height="54" alt="Image illustrating the combined effect of the :first-letter and :first-line pseudo-elements" src="first-letter.gif" width="105"> </p></div>
  1405. <p>The fictional tag sequence is:</p><pre>&lt;P&gt;
  1406. &lt;SPAN&gt;
  1407. &lt;P::first-letter&gt;
  1408. T
  1409. &lt;/P::first-letter&gt;he first
  1410. &lt;/SPAN&gt;
  1411. few words of an article in the Economist.
  1412. &lt;/P&gt;
  1413. </pre>
  1414. <p>Note that the <code>::first-letter</code> pseudo-element tags abut the content
  1415. (e.g., the initial character). When both the <code>::first-line</code> and the
  1416. <code>::first-letter</code> pseudo-elements are used, the <code>::first-letter</code>
  1417. fictional tag sequence is inserted inside the <code>::first-line</code>
  1418. fictional tag sequence.</p></div>
  1419. <p>In order to achieve traditional drop caps formatting, user agents may
  1420. approximate font sizes, for example to align baselines. Also, the glyph outline
  1421. may be taken into account when formatting.
  1422. </p><p>Punctuation (i.e, characters defined in Unicode <a class="noxref" href="#UNICODE" rel="biblioentry"><span class="normref">[UNICODE]</span></a> in the "open" (Ps), "close" (Pe), and "other"
  1423. (Po) punctuation classes), that precedes the first letter should be included, as
  1424. in:
  1425. </p><div class="figure">
  1426. <p><img height="72" alt="Quotes that precede the
  1427. first letter should be included." src="first-letter2.gif" width="114"></p></div>
  1428. <p>The <code>::first-letter</code> pseudo-element matches parts of elements
  1429. only.
  1430. </p><p>Some languages may have specific rules about how to treat certain letter combinations.
  1431.   In Dutch, for example, if the letter combination "ij" appears at the beginning
  1432.   of a word, both letters should be considered within the <code>::first-letter</code>
  1433.   pseudo-element. The <code>::first-letter</code> pseudo-element should select
  1434.   select from beginning of element up to the first non-opening-punctuation character
  1435.   cluster.
  1436. </p><p>
  1437. </p><div class="example">
  1438. <p><a name="overlapping-example">The following example</a> illustrates how
  1439. overlapping pseudo-elements may interact. The first letter of each
  1440. <code>P</code> element will be green with a font size of '24pt'. The rest of the
  1441. first formatted line will be 'blue' while the rest of the paragraph will be
  1442. 'red'.</p><pre>P { color: red; font-size: 12pt }
  1443. P::first-letter { color: green; font-size: 200% }
  1444. P::first-line { color: blue }
  1445.  
  1446. &lt;P&gt;Some text that ends up on two lines&lt;/P&gt;
  1447. </pre>
  1448. <p>Assuming that a line break will occur before the word "ends", the fictional
  1449. tag sequence for this fragment might be:</p><pre>&lt;P&gt;
  1450. &lt;P::first-line&gt;
  1451. &lt;P::first-letter&gt;
  1452. S
  1453. &lt;/P::first-letter&gt;ome text that
  1454. &lt;/P::first-line&gt;
  1455. ends up on two lines
  1456. &lt;/P&gt;
  1457. </pre>
  1458. <p>Note that the<code>::first-letter</code> element is inside the
  1459. <code>::first-line</code> element. Properties set on <code>::first-line</code> are
  1460. inherited by <code>::first-letter</code>, but are overridden if the same property is
  1461. set on <code>::first-letter</code>.</p></div>
  1462. <h4><a name="UIfragments">7.3 The UI element fragments pseudo-elements</a></h4>
  1463. <h5><a name="selection">The ::selection pseudo-element</a></h5>
  1464. <p>The <code>::selection</code> pseudo-element applies to the portion of a document
  1465. that has been highlighted by the user. This also applies, for example, to
  1466. selected text within an editable text field. This
  1467. pseudo-element should not be confused with the <code><a href="#checked">:checked</a></code>
  1468. pseudo-class (which used to be named <code>:selected</code>)
  1469. </p><p>Although the <code>::selection</code> pseudo-element is dynamic in nature,
  1470.   and is altered by user action, it is reasonable to expect that when a UA rerenders
  1471.   to a static medium (such as a printed page, see <a href="#CSS2">[CSS2]</a>)
  1472.   which was originally rendered to a dynamic medium (like screen), the UA may
  1473.   wish to transfer the current <code>::selection</code> state to that other medium,
  1474.   and have all the appropriate formatting and rendering take effect as well. This
  1475.   is not required - UAs may omit the <code>::selection</code> pseudo-element for
  1476.   static media.
  1477. </p><p>These are the CSS properties that apply to <code>::selection</code>
  1478. pseudo-elements: color, cursor, background, outline. The computed value of the 'background-image' property on
  1479. <code>::selection</code> may be ignored.
  1480. </p><h4><a name="gen-content">7.4 The ::before and ::after pseudo-elements</a></h4>
  1481. <p>The <code>::before</code> and <code>::after</code> pseudo-elements can be used to
  1482. describe generated content before or after an element's content. They are
  1483. explained in the Generated Content/Markers CSS3 Module.
  1484. </p><p>When the <code>::first-letter</code> and <code>::first-line</code> pseudo-elements
  1485. are combined with <code>::before</code> and <code>::after</code>, they apply to the
  1486. first letter or line of the element including the inserted text.
  1487. </p><h2><a name="combinators">8. Combinators</a></h2>
  1488. <h3><a name="descendant-combinators">8.1 Descendant combinator</a></h3>
  1489. <p>At times, authors may want selectors to describe an element that is the descendant
  1490.  of another element in the document tree (e.g., "an <code>EM</code> element that
  1491.  is contained within an <code>H1</code> element"). Descendant combinators express
  1492.  such a relationship. A descendant combinator is a <a href="#whitespace">white space</a> that separates two sequences of simple selectors.
  1493.  A selector of the form "<code>A B</code>" represents an element <code>B</code>
  1494.  that is an arbitrary descendant of some ancestor element <code>A</code>.
  1495. </p><div class="example">Examples:
  1496.  <p>For example, consider the following selector: </p><pre>h1 em</pre>
  1497.  It represents an <code>em</code> element being the descendant of an <code>h1</code>
  1498.  element. It is a correct and valid, but partial, description of the following
  1499.  fragment:
  1500.  <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline&nbsp;
  1501. is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>The
  1502. following selector: <pre>div * p</pre>represents a <code>p</code> element that is a grandchild or later
  1503. descendant of a <code>div</code> element. Note the white space on either side of the
  1504. "*".
  1505. <p>The following selector, which combines descendant combinators and <a href="#attribute-selectors">attribute
  1506. selectors</a>, represents an element that (1) has the <code>href</code> attribute
  1507. set and (2) is inside a <code>p</code> that is itself inside a <code>div</code>: </p><pre>div p *[href]</pre></div>
  1508. <h3><a name="child-combinators">8.2 Child combinators</a></h3>
  1509. <p>A&nbsp;<dfn>child combinator</dfn> describes a childhood relationship between
  1510.  two elements. A child combinator is made of the "greater-than sign"
  1511.  (<code>&gt;</code>) character and separates two sequences of simple selectors.
  1512.  
  1513. </p><div class="example">Examples:
  1514.  <p>The following selector represents a <code>p</code> element that is child of
  1515. <code>body</code>: </p><pre>body &gt; p</pre>
  1516.  <p>The following example combines descendant combinators and child combinators.
  1517. </p><pre>div ol&gt;li p</pre>
  1518. <p>It represents a <code>p</code> element that is a descendant of an <code>li</code>;
  1519. the <code>li</code> element must be the child of an <code>ol</code> element; the
  1520. <code>ol</code> element must be a descendant of a <code>div</code>. Notice that the
  1521. optional white space around the "&gt;" combinator has been left out.
  1522. </p><p>For information on selecting the first child of an element, please see the
  1523. section on the <code><a href="#structural-pseudos">:first-child</a></code>
  1524. pseudo-class above. </p></div>
  1525. <h3><a name="adjacent-combinators">8.3 Adjacent sibling combinators</a></h3>
  1526. <p>There are two different adjacent sibling combinators: direct adjacent
  1527. combinator and indirect adjacent combinator.
  1528. </p><h4><a name="adjacent-d-combinators">8.3.1 Direct adjacent combinators</a></h4>
  1529. <p>Direct adjacent combinators are made of the "plus sign" (<code>+</code>)
  1530.  character that separates two sequences of simple selectors. The elements represented
  1531.  by the two sequences share the same parent in the document tree and the element
  1532.  represented by the first sequence immediately precedes the element represented
  1533.  by the second one.
  1534. </p><div class="example">Examples:
  1535.  <p>Thus, the following selector represents a <code>p</code> element immediately
  1536. following a <code>math</code> element: </p><pre>math + p</pre>
  1537.  <p>The following selector is conceptually similar to the one in the previous
  1538. example, except that it adds an attribute selector. Thus, it adds a constraint
  1539. to the <code>h1</code> element that must have <code>class="opener"</code>: </p><pre>h1.opener + h2</pre></div>
  1540. <h4><a name="adjacent-i-combinators">8.3.2 Indirect adjacent combinator</a></h4>
  1541. <p>Indirect adjacent combinators are made of the "tilde" (<code>~</code>)
  1542.  character that separates two sequences of simple selectors. The elements represented
  1543.  by the two sequences share the same parent in the document tree and the element
  1544.  represented by the first sequence precedes (not necessarily immediately) the
  1545.  element represented by the second one.
  1546. </p><div class="example">Example:
  1547.  <pre>h1 ~ pre</pre>represents a <code>pre</code> element following an <code>h1</code>. It
  1548. is a correct and valid, but partial, description of: <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
  1549. &lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
  1550. &lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre></div>
  1551. <h2><a name="specificity">9. Calculating a selector's specificity</a></h2>
  1552. <p>A selector's specificity is calculated as follows:
  1553. </p><ul>
  1554.  <li>negative selectors are counted like their simple selectors argument
  1555.  </li><li>count the number of ID attributes in the selector (= a)
  1556.  </li><li>count the number of other attributes and pseudo-classes in the selector (=
  1557.  b)
  1558.  </li><li>count the number of element names in the selector (= c)
  1559.  </li><li>ignore pseudo-elements. </li></ul>
  1560. <p>Concatenating the three numbers a-b-c (in a number system with a large base)
  1561. gives the specificity.
  1562. </p><div class="example">
  1563.  <p>Some examples: </p><pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
  1564. LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
  1565. UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
  1566. UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
  1567. H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
  1568. UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
  1569. LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
  1570. #x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
  1571. #s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
  1572. </pre>
  1573. <p><b>Note</b>: the specificity of the styles specified in a HTML
  1574. <code>style</code> attribute is described in another CSS3 Module "Cascade and
  1575. Inheritance".</p></div>
  1576. <div class="html-example"></div>
  1577. <h2><a name="w3cselgrammar">10. The grammar of <span class="modulename">Selectors</span></a></h2>
  1578. <h3><a name="grammar">10.1 Grammar</a></h3>
  1579. <p>The grammar below defines the syntax of <span class="modulename">Selectors</span>.
  1580.  It is globally LL(1)  and can be locally LL(2) (but note that most UA's should not use it directly,
  1581.   since it doesn't express the parsing conventions). The format of the productions
  1582.  is optimized for human consumption and some shorthand notations beyond Yacc
  1583.  (see&nbsp;<span class="normref"><a class="noxref" href="#yacc" rel="biblioentry">[YACC]</a></span>) are used:
  1584. </p><ul>
  1585.  <li><b>*</b>: 0 or more
  1586.  </li><li><b>+</b>: 1 or more
  1587.  </li><li><b>?</b>: 0 or 1
  1588.  </li><li><b>|</b>: separates alternatives
  1589.  </li><li><b>[ ]</b>: grouping </li></ul>
  1590. <p>The productions are:
  1591. </p><pre>selectors_group
  1592.  : selector [ ',' S* selector ]*
  1593.  ;
  1594.  
  1595. selector
  1596.  /* there is at least one sequence of simple selectors in a */
  1597.  /* selector and the pseudo-elements occur only in the last */
  1598.  /* sequence ; only pseudo-element may occur */
  1599.  : [ simple_selector_sequence combinator ]*
  1600.       simple_selector_sequence [ pseudo_element ]?
  1601.  ;
  1602.  
  1603. combinator
  1604.  /* combinators can be surrounded by white space */
  1605.  : S* [ '+' | '&gt;' | '~' | /* empty */ ] S*
  1606.  ;
  1607.  
  1608. simple_selector_sequence
  1609.  /* the universal selector is optional */
  1610.  : [ type_selector | universal ]?
  1611.        [ HASH | class | attrib | pseudo_class | negation ]+ |
  1612.    type_selector | universal
  1613.  ;
  1614.  
  1615. type_selector
  1616.  : [ namespace_prefix ]? element_name
  1617.  ;
  1618.  
  1619. namespace_prefix
  1620.  : [ IDENT | '*' ]? '|'
  1621.  ;
  1622.  
  1623. element_name
  1624.  : IDENT
  1625.  ;
  1626.  
  1627. universal
  1628.  : [ namespace_prefix ]? '*'
  1629.  ;
  1630.  
  1631. class
  1632.  : '.' IDENT
  1633.  ;
  1634.  
  1635. attrib
  1636.  : '[' S* [ namespace_prefix ]? IDENT S*
  1637.        [ [ PREFIXMATCH |
  1638.            SUFFIXMATCH |
  1639.            SUBSTRINGMATCH |
  1640.            '=' |
  1641.            INCLUDES |
  1642.            DASHMATCH ] S* [ IDENT | STRING ] S*
  1643.        ]? ']'
  1644.  ;
  1645.  
  1646. pseudo_class
  1647.  /* a pseudo-class is an ident, or a function taking an */
  1648.  /* ident or a string or a number or a simple selector  */
  1649.  /* (excluding negation and pseudo-elements) */
  1650.  /* or a an+b expression for argument */
  1651.  : ':' [ IDENT | functional_pseudo ]
  1652.  ;
  1653.  
  1654. functional_pseudo
  1655.  : FUNCTION S* [ IDENT | STRING | NUMBER |
  1656.                  expression | negation_arg ] S* ')'
  1657.  ;
  1658.  
  1659. expression
  1660.  :  [ [ '-' | INTEGER ]? 'n' [ SIGNED_INTEGER ]? ] | INTEGER
  1661.  ;
  1662.  
  1663. negation_arg
  1664.  : type_selector | universal | HASH | class | attrib | pseudo_class
  1665.  ;
  1666.  
  1667. pseudo_element
  1668.  : [ ':' ]? ':' IDENT
  1669.  ;
  1670. </pre>
  1671. <h3><a name="lex">10.2 Lexical scanner</a></h3>
  1672. <p>The following is the&nbsp;<a name="x3"></a><span class="index-def" title="tokenizer">tokenizer</span>, written in Flex (see&nbsp;<span class="normref"><a class="noxref" href="#flex" rel="biblioentry">[FLEX]</a></span>) notation. The tokenizer is case-insensitive.
  1673.  
  1674. </p><p>The two occurrences of "\377" represent the highest character number that
  1675. current versions of Flex can deal with (decimal 255). They should be read as
  1676. "\4177777" (decimal 1114111), which is the highest possible code point
  1677. in&nbsp;<a name="x4"></a><span class="index-inst" title="unicode">Unicode</span>/<a name="x5"></a><span class="index-inst" title="iso-10646">ISO-10646</span>. </p><pre>%option case-insensitive
  1678.  
  1679. h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [0-9a-f]
  1680. nonascii&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [\200-\377]
  1681. unicode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\{h}{1,6}[ \t\r\n\f]?
  1682. escape&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {unicode}|\\[ -~\200-\377]
  1683. nmstart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [a-z_]|{nonascii}|{escape}
  1684. nmchar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [a-z0-9-_]|{nonascii}|{escape}
  1685. string1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \"([\t !#$%&amp;(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
  1686. string2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \'([\t !#$%&amp;(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
  1687.  
  1688. ident&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {nmstart}{nmchar}*
  1689. name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {nmchar}+
  1690. integer                 [-]?[0-9]+
  1691. signed_integer          [-+][0-9]+
  1692. num&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {integer}|[0-9]*"."[0-9]+
  1693. string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {string1}|{string2}
  1694. nl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n|\r\n|\r|\f
  1695. %%
  1696.  
  1697. [ \t\r\n\f]+&nbsp;&nbsp;&nbsp; {return S;}
  1698.  
  1699. \/\*[^*]*\*+([^/][^*]*\*+)*\/&nbsp;&nbsp; /* ignore comments */
  1700.  
  1701. "~="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return INCLUDES;}
  1702. "|="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return DASHMATCH;}
  1703. "^="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(return PREFIXMATCH;)
  1704. "$="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(return SUFFIXMATCH;)
  1705. "*="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(return SUBSTRINGMATCH;)
  1706. {string}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{return STRING;}
  1707. {ident}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return IDENT;}
  1708. {ident}"("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{return FUNCTION;}
  1709. {num}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{return NUMBER;}
  1710. {signed_integer}        {return SIGNED_INTEGER;}
  1711. {integer]               {return INTEGER;}
  1712. "#"{name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{return HASH;}
  1713.  
  1714. .&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{return *yytext;}</pre>
  1715. <h2><a name="downlevel">11. Namespaces and Down-Level Clients</a></h2>
  1716. <p>An important issue is the interaction of CSS selectors with XML documents in
  1717. web clients that were produced prior to this document. Unfortunately, due to the
  1718. fact that namespaces must be matched based on the URI which identifies the
  1719. namespace, not the namespace prefix, some mechanism is required to identify
  1720. namespaces in CSS by their URI as well. Without such a mechanism, it is
  1721. impossible to construct a CSS style sheet which will properly match selectors in
  1722. all cases against a random set of XML documents. However, given complete
  1723. knowledge of the XML document to which a style sheet is to be applied, and a
  1724. limited use of namespaces within the XML document, it is possible to construct a
  1725. style sheet in which selectors would match elements and attributes correctly.
  1726.  
  1727. </p><p>It should be noted that a down-level CSS client will (if it properly conforms
  1728. to CSS forward compatible parsing rules) ignore all <code>@namespace</code>
  1729. at-rules, as well as all style rules that make use of namespace qualified
  1730. element type or attribute selectors. The syntax of delimiting namespace prefixes
  1731. in CSS was deliberately chosen so that down-level CSS clients would ignore the
  1732. style rules rather than possibly match them incorrectly.
  1733. </p><p>The use of default namespaces in CSS makes it possible to write element type
  1734. selectors that will function in both namespace aware CSS clients as well as
  1735. down-level clients. It should be noted that down-level clients may incorrectly
  1736. match selectors against XML elements in other namespaces.
  1737. </p><p>The following are scenarios and examples in which it is possible to construct
  1738. style sheets which would function properly in web clients that do not implement
  1739. this proposal.
  1740. </p><ol>
  1741.  <li>The XML document does not use namespaces.
  1742.  <ul>
  1743.    <li>In this case, it is obviously not necessary to declare or use namespaces
  1744.    in the style sheet. Standard CSS element type and attribute selectors will
  1745.    function adequately in a down-level client.
  1746.    </li><li>In a CSS namespace aware client, the default behavior of element
  1747.    selectors matching without regard to namespace will function properly
  1748.    against all elements, since no namespaces are present. However, the use of
  1749.    specific element type selectors that match only elements that have no
  1750.    namespace ("<code>|name</code>") will guarantee that selectors will match only
  1751.    XML elements that do not have a declared namespace. </li></ul>
  1752.  </li><li>The XML document defines a single, default namespace used throughout the
  1753.  document. No namespace prefixes are used in element names.
  1754.  <ul>
  1755.    <li>In this case, a down-level client will function as if namespaces were
  1756.    not used in the XML document at all. Standard CSS element type and attribute
  1757.    selectors will match against all elements. </li></ul>
  1758.  </li><li>The XML document does <b>not</b> use a default namespace, all namespace
  1759.    prefixes used are known to the style sheet author and there is a direct mapping
  1760.    between namespace prefixes and namespace URIs. (A given prefix may only be
  1761.    mapped to one namespace URI throughout the XML document, there may be multiple
  1762.    prefixes mapped to the same URI).
  1763.    <ul>
  1764.    <li>In this case, the down-level client will view and match element type and
  1765.    attribute selectors based on their fully qualified name, not the local part
  1766.    as outlined in the <a href="#typenmsp">Type selectors and
  1767.    Namespaces</a> section. CSS selectors may be declared using an escaped colon
  1768.    "<code>\:</code>" to describe the fully qualified names, e.g.
  1769.    "<code>html\:h1</code>" will match <code>&lt;html:h1&gt;</code>. Selectors using the
  1770.    qualified name will only match XML elements that use the same prefix. Other
  1771.    namespace prefixes used in the XML that are mapped to the same URI will not
  1772.    match as expected unless additional CSS style rules are declared for them.
  1773.    </li><li>Note that selectors declared in this fashion will <i>only</i> match in
  1774.    down-level clients. A CSS namespace aware client will match element type and
  1775.    attribute selectors based on the name's local part. So selectors declared
  1776.     with the fully qualified name will not match (unless there is no namespace
  1777.     prefix in the fully qualified name). </li></ul></li></ol>
  1778. <p>In other scenarios: when the namespace prefixes used in the XML are not known
  1779. in advance by the style sheet author; or a combination of elements with no
  1780. namespace are used in conjunction with elements using a default namespace; or
  1781. the same namespace prefix is mapped to <i>different</i> namespace URIs within
  1782. the same document, or in different documents; it is impossible to construct a
  1783. CSS style sheet that will function properly against all elements in those
  1784. documents, unless, the style sheet is written using a namespace URI syntax (as
  1785. outlined in this document or similar) and the document is processed by a CSS and
  1786. XML namespace aware client.
  1787. </p><h2><a name="profiling">12. Profiles</a></h2>
  1788. <p>Each specification using <span class="modulename">Selectors</span> must define the subset of W3C
  1789. Selectors it allows and excludes, and describe the local meaning of all the
  1790. components of that subset.
  1791. </p><p>Non normative examples:
  1792. </p><div class="profile">
  1793. <table class="tprofile" width="75%" border="1">
  1794.   <tbody>
  1795.   <tr>
  1796.     <th class="title" colspan="2"><span class="modulename">Selectors</span> profile</th></tr>
  1797.   <tr>
  1798.     <th>Specification</th>
  1799.     <td>CSS level 1</td></tr>
  1800.   <tr>
  1801.     <th>Accepts</th>
  1802.     <td>type selectors <br>class selectors <br>ID selectors <br>:link,
  1803.       :visited and :active pseudo-classes <br>descendant combinator
  1804.       <br>:first-line and :first-letter pseudo-elements&nbsp;</td></tr>
  1805.   <tr>
  1806.     <th>Excludes</th>
  1807.     <td>
  1808.       <p>universal selector<br>attribute selectors<br>:hover and :focus
  1809.       pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
  1810.       element states pseudo-classes<br>all structural
  1811.       pseudo-classes<br>:contains() pseudo-class<br>negation pseudo-class<br>all
  1812.       UI element fragments pseudo-elements<br>::before and ::after
  1813.       pseudo-elements<br>child combinators<br>adjacent sibling combinators
  1814.       </p><p>namespaces</p></td></tr>
  1815.   <tr>
  1816.     <th>Extra constraints</th>
  1817.     <td>only one class selector allowed per sequence of simple
  1818.   selectors</td></tr></tbody></table><br>&nbsp; <br>&nbsp;
  1819. <table class="tprofile" width="75%" border="1">
  1820.   <tbody>
  1821.   <tr>
  1822.     <th class="title" colspan="2"><span class="modulename">Selectors</span> profile</th></tr>
  1823.   <tr>
  1824.     <th>Specification</th>
  1825.     <td>CSS level 2</td></tr>
  1826.   <tr>
  1827.     <th>Accepts</th>
  1828.     <td>type selectors <br>universal selector <br>attribute presence and
  1829.       values selectors<br>class selectors <br>ID selectors <br>:link, :visited,
  1830.       :active, :hover, :focus, :lang() and :first-child pseudo-classes
  1831.       <br>descendant combinator <br>child combinator <br>adjacent direct
  1832.       combinator <br>::first-line and ::first-letter pseudo-elements<br>::before
  1833.       and ::after pseudo-elements</td></tr>
  1834.   <tr>
  1835.     <th>Excludes</th>
  1836.     <td>
  1837.       <p>content selectors <br>substring matching attribute selectors<br>:target
  1838.       pseudo-classes&nbsp; <br>all UI element states pseudo-classes<br>all
  1839.       structural pseudo-classes other than :first-child<br>:contains()
  1840.       pseudo-class<br>negation pseudo-class<br>all UI element fragments
  1841.       pseudo-elements<br>adjacent indirect combinators
  1842.       </p><p>namespaces</p></td></tr>
  1843.   <tr>
  1844.     <th>Extra constraints</th>
  1845.     <td>more than one class selector per sequence of simple selectors (CSS1
  1846.       constraint) allowed</td></tr></tbody></table>
  1847. <p>In CSS, selectors express pattern matching rules that determine which style
  1848. rules apply to elements in the document tree.
  1849. </p><p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
  1850. with attribute <code>name</code> set inside a section 1 header <code>h1</code>: </p><pre>h1 a[name]</pre>
  1851. <p>All CSS declarations attached to such a selector are applied to elements
  1852. matching it. </p></div>
  1853. <div class="profile">
  1854. <table class="tprofile" width="75%" border="1">
  1855.   <tbody>
  1856.   <tr>
  1857.     <th class="title" colspan="2"><span class="modulename">Selectors</span> profile</th></tr>
  1858.   <tr>
  1859.     <th>Specification</th>
  1860.       <td>STTS 3</td>
  1861.     </tr>
  1862.   <tr>
  1863.     <th>Accepts</th>
  1864.     <td>
  1865.       <p>type selectors<br>universal selectors<br>attribute selectors<br>class
  1866.       selectors<br>ID selectors<br>all structural pseudo-classes<br>
  1867.           :contains() pseudo-class<br>
  1868.           all combinators
  1869.       </p><p>namespaces</p></td></tr>
  1870.   <tr>
  1871.     <th>Excludes</th>
  1872.     <td>non accepted pseudo-classes<br>pseudo-elements<br></td></tr>
  1873.   <tr>
  1874.     <th>Extra constraints</th>
  1875.     <td>some selectors and combinators are not allowed in fragment
  1876.       descriptions on the right side of STTS declarations.</td></tr></tbody></table>
  1877.   <p><span class="modulename">Selectors</span> can be used in STTS 3 in two different
  1878.     manners:
  1879. </p><ol>
  1880.   <li>a selection mechanism equivalent to CSS selection mechanism: declarations
  1881.   attached to a given selector are applied to elements matching that selector,
  1882.   </li><li>fragment descriptions that appear on the right side of declarations.
  1883. </li></ol></div>
  1884. <h2><a name="Conformance"></a>13. Conformance and Requirements</h2>
  1885. <p>This section defines conformance with the present specification only.
  1886. </p><p>The inability of a user agent to implement part of this specification due to
  1887. the limitations of a particular device (e.g., non interactive user agents will
  1888. probably not implement dynamic pseudo-classes because they make no sense without
  1889. interactivity) does not imply non-conformance.
  1890. </p><p>All specifications reusing <span class="modulename">Selectors</span> must contain a <a href="#profiling">Profile</a> listing the
  1891. subset of <span class="modulename">Selectors</span> it accepts or excludes, and describing the constraints
  1892. it adds to the current specification.
  1893. </p><p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
  1894. which is not allowed at the current parsing point.
  1895. </p><p>User agents must observe the rules for handling parsing errors:
  1896. </p><ul>
  1897.   <li>a simple selector containing an undeclared namespace prefix is invalid</li>
  1898.   <li>a selector containing an invalid simple selector, an invalid combinator
  1899.     or an invalid token is invalid. </li>
  1900.   <li>a group of selectors containing an invalid selector is invalid.</li>
  1901. </ul>
  1902. <p>Implementations of this specification must behave as "recipients
  1903. of text data" as defined by
  1904. <a class="noxref" href="#CWWW" rel="biblioentry"><span class="normref">[CWWW]</span></a>
  1905. when parsing selectors and attempting matches. (In particular, implementations must assume
  1906. the data is normalized and must not normalize it.) Normative rules
  1907. for matching strings are defined in
  1908. <a class="noxref" href="#CWWW" rel="biblioentry"><span class="normref">[CWWW]</span></a>
  1909. and <a class="noxref" href="#UNICODE" rel="biblioentry"><span class="normref">[UNICODE]</span></a>
  1910. and apply to implementations of this specification.
  1911.  
  1912. </p><h2><a name="Tests"></a>14. Tests</h2>
  1913. <p>This specification contains a test suite allowing user agents to verify their
  1914. basic conformance to the specification. This test suite does not pretend to be
  1915. exhaustive and does not cover all possible combined cases of <span class="propernoun">Selectors</span>.
  1916. </p><p>These tests are available [link forthcoming].
  1917. </p><h2><a name="ACKS"></a>15. Acknowledgements</h2>
  1918. <p>This specification is the product of the W3C Working Group on Cascading Style
  1919. Sheets and Formatting Properties. In addition to the editors of this
  1920. specification, the members of the Working Group are:
  1921. </p><ul>
  1922.   <li>Marc Attinasi (Netscape/AOL)
  1923.   </li><li>Bert Bos (W3C)
  1924.   </li><li>Tantek Çelik (Microsoft Corp.)
  1925.   </li><li>Don Day (IBM)
  1926.   </li><li>Martin Dürst (W3C)
  1927.   </li><li>Angel Diaz (IBM)
  1928.   </li><li>Daniel Glazman (Netscape/AOL from November 2000, and Electricité de France
  1929.     until February 2000)
  1930.   </li><li>Håkon W. Lie (Opera Software from April 1999, and W3C until April 1999)
  1931.   </li><li>Chris Lilley (W3C)
  1932.   </li><li>Dave Raggett (W3C/Openwave Systems Inc.)
  1933.   </li><li>Pierre Saslawsky (Netscape/AOL)
  1934.   </li><li>Robert Stevahn (Hewlett-Packard)
  1935.   </li><li>Michel Suignard (Microsoft Corp.)
  1936.   </li><li>Ted Wugofski (Openwave Systems Inc.)
  1937.   </li><li>Steve Zilles (Adobe) </li></ul>
  1938. <p>A number of invited experts to the Working Group have significantly contributed
  1939.   to CSS3: L. David Baron, Tim Boland (NIST), Todd Fahrner, Daniel Glazman, Ian
  1940.   Hickson, Eric Meyer (The OPAL Group), Jeff Veen.
  1941. </p><p>Former members of the Working Group:
  1942. </p><ul>
  1943.   <li>Chris Brichford (Adobe)
  1944.   </li><li>Troy Chevalier (Netscape/AOL)
  1945.   </li><li>Dwayne Dicks (SoftQuad)
  1946.   </li><li>Ian Jacobs (W3C)
  1947.   </li><li>Lorin Jurow (Quark)
  1948.   </li><li>Sho Kuwamoto (Macromedia)
  1949.   </li><li>Peter Linss (Netscape/AOL)
  1950.   </li><li>Steven Pemberton (CWI)
  1951.   </li><li>Robert Pernett (Lotus)
  1952.   </li><li>Douglas Rand (SGI)
  1953.   </li><li>Nisheeth Ranjan (Netscape/AOL)
  1954.   </li><li>Ed Tecot (Microsoft Corp.)
  1955.   </li><li>Jared Sorensen (Novell)
  1956.   </li><li>Mike Wexler (Adobe)
  1957.   </li><li>John Williams (Quark)
  1958.   </li><li>Chris Wilson (Microsoft Corp.) </li></ul>
  1959. <p>We thank all of them (members, invited experts and former members) for their
  1960. efforts.
  1961. </p><p>Of course, this document derives from the CSS Level 1 and CSS level 2
  1962. Recommendations. We thank all CSS1 and CSS2 authors, editors and
  1963. contributors.
  1964. </p><p>Dr. Hasan Ali Çelik suggested the simple and powerful syntax of the argument
  1965. for :nth-child() while the Working Group was considering much more complex
  1966. solutions.
  1967. </p><p>The discussions on www-style@w3.org have been influential in many key issues.
  1968.   Especially, we would like to thank Ian Graham, David Baron, Björn Höhrmann,
  1969.   <i>fantasai</i>, Jelks Cabanis and Matthew Brealey for their active and useful
  1970.   participation.
  1971. </p><h2><a name="references">16. References</a></h2>
  1972. <ol class="refs">
  1973.   <li>[CSS1] <a name="CSS1"></a>Bert Bos, Håkon Wium Lie; "<i>Cascading Style
  1974.    Sheets, level 1</i>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999<br>
  1975.     (<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
  1976.   </li><li>[CSS2]<a name="CSS2"></a> Bert Bos, Håkon Wium Lie, Chris Lilley, Ian
  1977.     Jacobs, editors; "<i>Cascading Style Sheets, level 2</i>", W3C Recommendation,
  1978.     12 May 1998 <br>
  1979.     (<code><a href="http://www.w3.org/TR/REC-CSS2/">http://www.w3.org/TR/REC-CSS2/</a></code>)
  1980.   </li><li id="CWWW">[CWWW] Martin J. Dürst, François Yergeau, Misha Wolf,
  1981.     Asmus Freytag, Tex Texin, editors; "<i>Character Model for the World Wide
  1982.    Web</i>", W3C Working Draft, 26 January 2001<br>
  1983.     (<code><a href="http://www.w3.org/TR/2001/WD-charmod-20010126">http://www.w3.org/TR/2001/WD-charmod-20010126</a></code>)
  1984.   </li><li>[FLEX] <a name="flex"></a>"Flex: The Lexical Scanner Generator",
  1985.     Version 2.3.7, ISBN 1882114213</li>
  1986.   <li>[HTML4.01] <a name="html40"></a>Dave Ragget, Arnaud Le Hors, Ian Jacobs,
  1987.     editors; "HTML 4.01 Specification", W3C Recommendation, 24 December
  1988.     1999<br>
  1989.     (<a href="http://www.w3.org/TR/html401/"><code>http://www.w3.org/TR/html401/</code></a>)</li>
  1990.   <li>[MATH] <a name="MATH"></a>Patrick Ion, Robert Miner; "<i>Mathematical
  1991.    Markup Language (MathML) 1.01</i>", W3C Recommendation, revision of 7
  1992.     July 1999<br>
  1993.     (<code><a href="http://www.w3.org/1999/07/REC-MathML-19990707">http://www.w3.org/1999/07/REC-MathML-19990707</a></code>)<br>
  1994.   </li>
  1995.   <li>[NMSP]&nbsp;<a name="nmsp19990625"></a>Peter Linss, editor; "<i>CSS Namespace
  1996.    Enhancements (Proposal)</i>", W3C Working Draft, 25 June 1999 <br>
  1997.     (<code><a href="http://www.w3.org/1999/06/25/WD-css3-namespace-19990625/">http://www.w3.org/1999/06/25/WD-css3-namespace-19990625/</a></code>)
  1998.   </li>
  1999.   <li>[RFC3066] <a name="rfc3066"></a>H. Alvestrand; "Tags for the Identification
  2000.    of Languages", Request for Comments 3066, January 2001<br>
  2001.     (<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
  2002.   </li>
  2003.   <li>[STTS3]<a name="STTS"></a> Daniel Glazman ; "<i>Simple Tree Transformation
  2004.    Sheets 3</i>", Electricité de France, submission to the W3C, 11 Nov
  2005.     1998 <br>
  2006.     (<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
  2007.   </li><li>[SVG] <a name="SVG"></a>Jon Ferraiolo ed.; "<i>Scalable Vector Graphics
  2008.    (SVG) 1.0 Specification</i>", W3C Proposed Recommendation, 19 July 2001<br>
  2009.     (<code><a href="http://www.w3.org/TR/2001/PR-SVG-20010719">http://www.w3.org/TR/2001/PR-SVG-20010719</a></code>)<br>
  2010.   </li><li>[UI]&nbsp;<a name="UI-WD"></a>Tantek Çelik, editor; "<i>User Interface
  2011.    for CSS3</i>", W3C Working Draft, 16 February 2000 <br>
  2012.     (<code><a href="http://www.w3.org/TR/2000/WD-css3-userint-20000216">http://www.w3.org/TR/2000/WD-css3-userint-20000216</a></code>)
  2013.   </li><li>[UNICODE] <a name="UNICODE"></a>"<i>The Unicode Standard: Version 3.0.1</i>",
  2014.     The Unicode Consortium, Addison Wesley Longman, 2000, ISBN 0-201-61633-5.<br>
  2015.     URL: <a href="http://www.unicode.org/unicode/standard/versions/Unicode3.0.1.html">http://www.unicode.org/unicode/standard/versions/Unicode3.0.1.html</a>.<br>
  2016.     The latest version of Unicode. For more information, consult the Unicode Consortium's
  2017.    home page at <code><a href="http://www.unicode.org/">http://www.unicode.org/</a></code>.
  2018.  </li><li>[XML-NAMES] <a name="XMLNAMES"></a>Tim Bray, Dave Hollander, Andrew Layman,
  2019.    editors; "Namespaces in XML", W3C Recommendation, 14 January 1999<br>
  2020.    (<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)</li>
  2021.  <li>[YACC] <a name="yacc"></a>"YACC - Yet another compiler compiler",
  2022.    S. C. Johnson, Technical Report, Murray Hill, 1975</li>
  2023. </ol>
  2024. <!-- Keep this comment at the end of the file
  2025. Local variables:
  2026. mode: sgml
  2027. sgml-declaration:"~/SGML/HTML4.decl"
  2028. sgml-default-doctype-name:"html"
  2029. sgml-minimize-attributes:t
  2030. sgml-nofill-elements:("pre" "style" "br")
  2031. End:
  2032. -->
  2033.  
  2034. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement