Mon, 28 Oct 2013 16:17:39 -0700
[css-syntax] Remove the old versions of syntax. It's long since past time that they were completely obsolete.
css-syntax/old.html | file | annotate | diff | comparison | revisions | |
css-syntax/oldsrc.html | file | annotate | diff | comparison | revisions |
1.1 --- a/css-syntax/old.html Mon Oct 28 15:36:16 2013 -0700 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,2799 +0,0 @@ 1.4 -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 1.5 -"http://www.w3.org/TR/html4/loose.dtd"> 1.6 -<!-- vim:expandtab:tabstop=2:shiftwidth=2:textwidth=72: 1.7 - --> 1.8 - 1.9 -<html><!-- the command line to process is this is: 1.10 - 1.11 -num -l 2 template.html | toc -l 2 | incl | xref | index |\ 1.12 -perl -I../bin ../bin/propindex | cite-mkbib ../biblio.ref \ 1.13 ->template-processed.html 1.14 - 1.15 - 1.16 -To do: add longdesc 1.17 - 1.18 ---> 1.19 - 1.20 - <head> 1.21 - <title>CSS Syntax Module Level 3</title> 1.22 - <link href="../default.css" rel=stylesheet type="text/css"> 1.23 - <link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel=stylesheet 1.24 - type="text/css"> 1.25 - 1.26 - <body> 1.27 - <div class=head> 1.28 - <p><a class=logo href="http://www.w3.org/" rel=home><img alt=W3C height=48 1.29 - src="http://www.w3.org/Icons/w3c_home" width=72></a><a class=logo 1.30 - href="../" rel=in-activity><img alt=" CSS WG" height=48 1.31 - src="../../../Woolly/woolly-icon.png" width=72></a></p> 1.32 - 1.33 - <h1>CSS Syntax Module Level 3</h1> 1.34 - 1.35 - <h2 class="no-num no-toc" id=w3c-working-draft-date-13-august-2003>W3C 1.36 - Working Draft 12 April 2012</h2> 1.37 - 1.38 - <dl> 1.39 - <dt>This version: 1.40 - 1.41 - <dd><a 1.42 - href="http://www.w3.org/TR/2012/WD-css3-syntax-[ISODATE]">http://www.w3.org/TR/2012/WD-css3-syntax-[ISODATE]</a> 1.43 - 1.44 - <dt>Latest version: 1.45 - 1.46 - <dd><a 1.47 - href="http://www.w3.org/TR/css3-syntax">http://www.w3.org/TR/css3-syntax</a> 1.48 - 1.49 - <dt>Previous version: 1.50 - 1.51 - <dd><a 1.52 - href="http://www.w3.org/TR/2003/WD-css3-syntax-20030813">http://www.w3.org/TR/2003/WD-css3-syntax-20030813</a> 1.53 - 1.54 - <dt>Editor: 1.55 - 1.56 - <dd><a href="http://dbaron.org/">L. David Baron</a>, <<a 1.57 - href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a>> 1.58 - 1.59 - <dt>Additional Contributors: 1.60 - 1.61 - <dd>Original CSS2 Authors 1.62 - 1.63 - <dd>Bert Bos (W3C), <<a href="mailto:bert@w3.org">bert@w3.org</a>> 1.64 - 1.65 - <dd>Peter Linss (Netscape) 1.66 - </dl> 1.67 - <!--begin-copyright--> 1.68 - <p class=copyright><a 1.69 - href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" 1.70 - rel=license>Copyright</a> © 2012 <a href="http://www.w3.org/"><abbr 1.71 - title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a 1.72 - href="http://www.csail.mit.edu/"><abbr 1.73 - title="Massachusetts Institute of Technology">MIT</abbr></a>, <a 1.74 - href="http://www.ercim.eu/"><abbr 1.75 - title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, 1.76 - <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a 1.77 - href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, 1.78 - <a 1.79 - href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> 1.80 - and <a 1.81 - href="http://www.w3.org/Consortium/Legal/copyright-documents">document 1.82 - use</a> rules apply.</p> 1.83 - <!--end-copyright--> 1.84 - <hr title="Separator for header"> 1.85 - </div> 1.86 - 1.87 - <p 1.88 - style="background: #fdd; color: red; font-weight: bold; text-align: center; padding: .5em; border: thick solid red; border-radius: 1em; position: fixed; bottom: 1em; left: 1em; right: 1em;">This 1.89 - specification is not being actively maintained, and should not be used as 1.90 - a guide for implementations. It may be revived in the future, but for now 1.91 - should be considered obsolete. <br> 1.92 - If you have questions or comments on this specification, please send an 1.93 - email to the CSS Working Group's mailing list at <a 1.94 - href="mailto:www-style@w3.org">www-style@w3.org</a>. (Before sending mail 1.95 - for the first time, you have to subscribe at <a 1.96 - href="http://lists.w3.org/Archives/Public/www-style/">http://lists.w3.org/Archives/Public/www-style/</a>.) 1.97 - 1.98 - <h2 class="no-num no-toc" id=abstract>Abstract</h2> 1.99 - 1.100 - <p>This CSS3 module describes the basic structure of CSS style sheets, some 1.101 - of the details of the syntax, and the rules for parsing CSS style sheets. 1.102 - It also describes (in some cases, informatively) how stylesheets can be 1.103 - linked to documents and how those links can be media-dependent. Additional 1.104 - details of the syntax of some parts of CSS described in other modules will 1.105 - be described in those modules. The selectors module has a grammar for 1.106 - selectors. Modules that define properties give the grammar for the values 1.107 - of those properties, in a format described in this document. 1.108 - 1.109 - <h2 class="no-num no-toc" id=status>Status of this document</h2> 1.110 - 1.111 - <p><em>This section describes the status of this document at the time of 1.112 - its publication. Other documents may supersede this document. A list of 1.113 - current W3C publications and the latest revision of this technical report 1.114 - can be found in the <a href="http://www.w3.org/TR/">W3C technical reports 1.115 - index</a> at http://www.w3.org/TR/. The latest revision can also be found 1.116 - by following the "Latest Version" link above.</em> 1.117 - 1.118 - <p> This document is a draft of one of the modules of CSS Level 3 (CSS3). 1.119 - Some parts of the document are derived from the CSS Level 1 and CSS Level 1.120 - 2 recommendations, and those parts are thus relatively stable. However, it 1.121 - is otherwise an early draft, and considerable revision is expected in 1.122 - later drafts, especially in formalization of error handling behavior, the 1.123 - conformance requirements for partial implementations (given the 1.124 - modularization of CSS3), and integration with other CSS3 modules. 1.125 - 1.126 - <p>This document is a working draft of the CSS working group which is part 1.127 - of the <a href="http://www.w3.org/Style/">style activity</a> (see <a 1.128 - href="http://www.w3.org/Style/Activity">summary</a>). 1.129 - 1.130 - <p>The working group would like to receive feedback: discussion takes place 1.131 - on the (<a 1.132 - href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public 1.133 - mailing list <a 1.134 - href="http://www.w3.org/Mail/Lists.html#www-style">www-style@w3.org</a> 1.135 - (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C 1.136 - Members can also send comments directly to the CSS working group. 1.137 - 1.138 - <p>This is a draft document and may be updated, replaced or obsoleted by 1.139 - other documents at any time. It is inappropriate to cite this document as 1.140 - other than work in progress. Its publication does not imply endorsement by 1.141 - the W3C membership or the <a href="http://www.w3.org/Style/Group/">CSS 1.142 - & FP Working Group</a> (<a 1.143 - href="http://cgi.w3.org/MemberAccess/AccessRequest">members only</a>). 1.144 - 1.145 - <p>Patent disclosures relevant to CSS may be found on the Working Group's 1.146 - public <a href="http://www.w3.org/Style/CSS/Disclosures" 1.147 - rel=disclosure>patent disclosure page.</a> 1.148 - 1.149 - <p>This document may be available in translations in the future. The 1.150 - English version of this specification is the only normative version. 1.151 - 1.152 - <h2 class="no-num no-toc" id=contents>Table of contents</h2> 1.153 - <!--begin-toc--> 1.154 - 1.155 - <ul class=toc> 1.156 - <li><a href="#dependencies-on-other-modules"><span class=secno>1. 1.157 - </span>Dependencies on other modules</a> 1.158 - 1.159 - <li><a href="#introduction"><span class=secno>2. </span>Introduction</a> 1.160 - 1.161 - <li><a href="#css-style-sheet-representation"><span class=secno>3. 1.162 - </span>CSS style sheet representation</a> 1.163 - <ul class=toc> 1.164 - <li><a href="#referring-to-characters-not-represented-"><span 1.165 - class=secno>3.1. </span>Referring to characters not represented in a 1.166 - character encoding</a> 1.167 - 1.168 - <li><a href="#the-textcss-content-type"><span class=secno>3.2. 1.169 - </span>The text/css content type</a> 1.170 - </ul> 1.171 - 1.172 - <li><a href="#syntax"><span class=secno>4. </span>General syntax of 1.173 - CSS</a> 1.174 - <ul class=toc> 1.175 - <li><a href="#characters"><span class=secno>4.1. </span>Characters and 1.176 - case</a> 1.177 - 1.178 - <li><a href="#tokenization"><span class=secno>4.2. 1.179 - </span>Tokenization</a> 1.180 - 1.181 - <li><a href="#grammar"><span class=secno>4.3. </span>Grammar</a> 1.182 - <ul class=toc> 1.183 - <li><a href="#principles-of-css-error-handling"><span 1.184 - class=secno>4.3.1. </span>Principles of CSS error handling</a> 1.185 - 1.186 - <li><a href="#style-sheets"><span class=secno>4.3.2. </span>Style 1.187 - sheets</a> 1.188 - </ul> 1.189 - 1.190 - <li><a href="#keywords"><span class=secno>4.4. </span>Keywords</a> 1.191 - 1.192 - <li><a href="#statements"><span class=secno>4.5. </span>Statements</a> 1.193 - 1.194 - <li><a href="#at-rules"><span class=secno>4.6. </span>At-rules</a> 1.195 - 1.196 - <li><a href="#blocks"><span class=secno>4.7. </span>Blocks</a> 1.197 - 1.198 - <li><a href="#rule-sets-declaration-blocks-and-selecto"><span 1.199 - class=secno>4.8. </span>Rule sets, declaration blocks, and 1.200 - selectors</a> 1.201 - 1.202 - <li><a href="#declarations"><span class=secno>4.9. </span>Declarations 1.203 - and properties</a> 1.204 - 1.205 - <li><a href="#comments"><span class=secno>4.10. </span>Comments</a> 1.206 - </ul> 1.207 - 1.208 - <li><a href="#error-handling"><span class=secno>5. </span>Rules for 1.209 - handling parsing errors or unsupported features</a> 1.210 - <ul class=toc> 1.211 - <li><a href="#partial-implementations"><span class=secno>5.1. 1.212 - </span>Partial implementations</a> 1.213 - </ul> 1.214 - 1.215 - <li><a href="#vendor-specific-extensions"><span class=secno>6. 1.216 - </span>Vendor-specific extensions</a> 1.217 - <ul class=toc> 1.218 - <li><a href="#historical-notes"><span class=secno>6.1. </span>Historical 1.219 - notes</a> 1.220 - </ul> 1.221 - 1.222 - <li><a href="#conf"><span class=secno>7. </span>Conformance</a> 1.223 - <ul class=toc> 1.224 - <li><a href="#definitions"><span class=secno>7.1. </span>Definitions</a> 1.225 - 1.226 - 1.227 - <li><a href="#conf-UA"><span class=secno>7.2. </span>User agent 1.228 - conformance</a> 1.229 - <ul class=toc> 1.230 - <li><a href="#error-conditions"><span class=secno>7.2.1. </span>Error 1.231 - conditions</a> 1.232 - </ul> 1.233 - 1.234 - <li><a href="#conf-SS"><span class=secno>7.3. </span>Style sheet 1.235 - conformance</a> 1.236 - 1.237 - <li><a href="#conf-AT"><span class=secno>7.4. </span>Authoring tool 1.238 - conformance</a> 1.239 - </ul> 1.240 - 1.241 - <li><a href="#property-defs"><span class=secno>8. </span>Format of 1.242 - property definitions in other modules</a> 1.243 - <ul class=toc> 1.244 - <li><a href="#property-def-value"><span class=secno>8.1. 1.245 - </span>Value</a> 1.246 - <ul class=toc> 1.247 - <li><a href="#initial-and-inherit-values"><span class=secno>8.1.1. 1.248 - </span><code>initial</code> and <code>inherit</code> values</a> 1.249 - </ul> 1.250 - 1.251 - <li><a href="#property-def-initial"><span class=secno>8.2. 1.252 - </span>Initial</a> 1.253 - 1.254 - <li><a href="#property-def-applies"><span class=secno>8.3. 1.255 - </span>Applies to</a> 1.256 - 1.257 - <li><a href="#property-def-inherited"><span class=secno>8.4. 1.258 - </span>Inherited</a> 1.259 - 1.260 - <li><a href="#property-def-computed"><span class=secno>8.5. 1.261 - </span>Computed value</a> 1.262 - 1.263 - <li><a href="#property-def-percent"><span class=secno>8.6. 1.264 - </span>Percentage values</a> 1.265 - 1.266 - <li><a href="#media-groups"><span class=secno>8.7. </span>Media 1.267 - groups</a> 1.268 - 1.269 - <li><a href="#shorthand-properties"><span class=secno>8.8. 1.270 - </span>Shorthand properties</a> 1.271 - </ul> 1.272 - 1.273 - <li><a href="#detailed-grammar"><span class=secno>9. </span>Appendix: 1.274 - Second grammar</a> 1.275 - <ul class=toc> 1.276 - <li><a href="#grammar0"><span class=secno>9.1. </span>Grammar</a> 1.277 - 1.278 - <li><a href="#lexical-scanner"><span class=secno>9.2. </span>Lexical 1.279 - scanner</a> 1.280 - </ul> 1.281 - 1.282 - <li class=no-num><a href="#changes-from-css2">Changes from CSS2</a> 1.283 - 1.284 - <li class=no-num><a href="#acknowledgments">Acknowledgments</a> 1.285 - 1.286 - <li class=no-num><a href="#references">References</a> 1.287 - <ul class=toc> 1.288 - <li class=no-num><a href="#normative-references">Normative 1.289 - references</a> 1.290 - 1.291 - <li class=no-num><a href="#other-references">Other references</a> 1.292 - </ul> 1.293 - 1.294 - <li class=no-num><a href="#index">Index</a> 1.295 - </ul> 1.296 - <!--end-toc--> 1.297 - 1.298 - <hr> 1.299 - 1.300 - <h2 id=dependencies-on-other-modules><span class=secno>1. 1.301 - </span>Dependencies on other modules</h2> 1.302 - 1.303 - <p>This CSS3 module depends on the following other CSS3 modules: 1.304 - 1.305 - <ul> 1.306 - <li>Selectors <a href="#SELECT" 1.307 - rel=biblioentry>[SELECT]<!--{{!SELECT}}--></a> 1.308 - 1.309 - <li>CSS3 module: Values & Units <a href="#CSS3VAL" 1.310 - rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a> 1.311 - 1.312 - <li>CSS3 module: Cascading & Inheritance <a href="#CSS3CASCADE" 1.313 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a> 1.314 - </ul> 1.315 - 1.316 - <p>It has non-normative (informative) references to the following other 1.317 - CSS3 modules: 1.318 - 1.319 - <ul> 1.320 - <li>CSS3 module: Paged media <a href="#CSS3PAGE" 1.321 - rel=biblioentry>[CSS3PAGE]<!--{{CSS3PAGE}}--></a> 1.322 - 1.323 - <li>CSS3 module: Speech <a href="#CSS3SPEECH" 1.324 - rel=biblioentry>[CSS3SPEECH]<!--{{CSS3SPEECH}}--></a> 1.325 - 1.326 - <li>Media queries <a href="#MEDIAQ" 1.327 - rel=biblioentry>[MEDIAQ]<!--{{MEDIAQ}}--></a> 1.328 - 1.329 - <li>Syntax of CSS rules in HTML's "style" attribute <a 1.330 - href="#CSSSTYLEATTR" 1.331 - rel=biblioentry>[CSSSTYLEATTR]<!--{{CSSSTYLEATTR}}--></a> 1.332 - </ul> 1.333 - 1.334 - <h2 id=introduction><span class=secno>2. </span>Introduction</h2> 1.335 - 1.336 - <p>This specification describes the basic syntax of CSS3 and the syntax 1.337 - conventions used in the property definitions spread through the CSS3 1.338 - modules. The syntax of CSS3 has some error-handling requirements for 1.339 - forward-compatibility, but much of the error-handling behavior depends on 1.340 - the user agent. 1.341 - 1.342 - <h2 id=css-style-sheet-representation><span class=secno>3. </span>CSS style 1.343 - sheet representation</h2> 1.344 - 1.345 - <p>A CSS style sheet is a sequence of characters from the Universal 1.346 - Character Set (see <a href="#ISO10646" 1.347 - rel=biblioentry>[ISO10646]<!--{{!ISO10646}}--></a>). For transmission and 1.348 - storage, these characters must be <dfn id=encoded 1.349 - title="character encoding">encoded</dfn> by a character encoding that 1.350 - supports the set of characters available in US-ASCII (e.g., ISO-8859-x, 1.351 - Shift_JIS, etc.). A <span class=index id=BOM>byte order mark (BOM)</span>, 1.352 - as described in section 2.7 of <a href="#UNICODE310" 1.353 - rel=biblioentry>[UNICODE310]<!--{{!UNICODE310}}--></a>, that begins the 1.354 - sequence of characters should not be considered, for purposes of applying 1.355 - the grammar below, as a part of the style sheet. For a good introduction 1.356 - to character sets and character encodings, please consult the HTML 4.0 1.357 - specification (<a href="#HTML40" 1.358 - rel=biblioentry>[HTML40]<!--{{!HTML40}}--></a>, chapter 5). See also the 1.359 - XML 1.0 specification (<a href="#XML10" 1.360 - rel=biblioentry>[XML10]<!--{{XML10}}--></a>, sections 2.2 and 4.3.3). 1.361 - 1.362 - <p>When a style sheet is embedded in another document, such as in the STYLE 1.363 - element or "style" attribute of HTML, the style sheet shares the character 1.364 - encoding of the whole document. 1.365 - 1.366 - <p>When a style sheet resides in a separate file, user agents must observe 1.367 - the following <span class=index id=priorities 1.368 - title="character encoding::user agent's determination of">priorities</span> 1.369 - when determining a style sheet's <span class=index id=character-encoding 1.370 - title="character encoding::default|default::character encoding">character 1.371 - encoding</span> (from highest priority to lowest): 1.372 - 1.373 - <ol> 1.374 - <li>A character encoding specified by a higher level protocol (e.g., the 1.375 - "charset" parameter to the MIME type specified in an HTTP "Content-Type" 1.376 - field). (The HTTP protocol (<a href="#HTTP11" 1.377 - rel=biblioentry>[HTTP11]<!--{{!HTTP11}}--></a>, section 3.7.1) mentions 1.378 - ISO-8859-1 as a default character encoding when the "charset" parameter 1.379 - is absent from the "Content-Type" header field. In practice, this 1.380 - recommendation has proved useless because some servers don't allow a 1.381 - "charset" parameter to be sent, and others may not be configured to send 1.382 - the parameter. Therefore, user agents must not assume any default value 1.383 - for the "charset" parameter, but must instead look for the <a class=index 1.384 - href="#charset0" id=charset>@charset</a> rule.) 1.385 - 1.386 - <li>The <dfn id=charset0>@charset</dfn> at-rule. 1.387 - 1.388 - <li>Assume that the style sheet is UTF-8. 1.389 - </ol> 1.390 - 1.391 - <p>Since the third point differs from CSS1 and CSS2, authors should not 1.392 - rely on user agents to assume that style sheets without encoding 1.393 - information are UTF-8 encoded. Authors should specify the encoding using 1.394 - one of the first two methods. 1.395 - 1.396 - <p>At most one @charset rule may appear in an external style sheet — 1.397 - it must <em>not</em> appear in an embedded style sheet — and it must 1.398 - appear at the very start of the style sheet, not preceded by any 1.399 - characters (except for the optional Byte Order Mark <a 1.400 - href="#BOM">described above)</a>. After "@charset", authors specify the 1.401 - name of a character encoding. The name must be a charset name as described 1.402 - in the IANA registry (See <a href="#RFC2978" 1.403 - rel=biblioentry>[RFC2978]<!--{{!RFC2978}}--></a>. Also, see <a 1.404 - href="#CHARSETS" rel=biblioentry>[CHARSETS]<!--{{CHARSETS}}--></a> for a 1.405 - complete list of charsets). For example: 1.406 - 1.407 - <div class=example> 1.408 - <p> @charset "ISO-8859-1"; 1.409 - </div> 1.410 - 1.411 - <p>This specification does not mandate which character encodings a user 1.412 - agent must support. <span class=issue>[Should we require a certain minimal 1.413 - set, such as UTF-8 and UCS2?]</span> 1.414 - 1.415 - <p>Note that reliance on the @charset construct theoretically poses a 1.416 - problem since there is no <em>a priori</em> information on how it is 1.417 - encoded. In practice, however, the encodings in wide use on the Internet 1.418 - are either based on ASCII, UTF-16, UCS-4, or (rarely) on EBCDIC. This 1.419 - means that in general, the initial byte values of a style sheet enable a 1.420 - user agent to detect the encoding family reliably, which provides enough 1.421 - information to decode the @charset rule, which in turn determines the 1.422 - exact character encoding. 1.423 - 1.424 - <div class=issue>[Should this specification describe how to handle encoding 1.425 - errors? Can a user agent ignore the <a 1.426 - href="#charset0"><code>@charset</code></a> rule if it's wrong? What if the 1.427 - user agent does not support the encoding used? Should this specification 1.428 - describe how to handle a <a href="#charset0"><code>@charset</code></a> 1.429 - rule that specifies a character encoding that is incompatible with the 1.430 - family of encodings used to decode the <a 1.431 - href="#charset0"><code>@charset</code></a> rule (and BOM) itself?]</div> 1.432 - <!-- More examples of good encodings to use? -IJ --> 1.433 - <!-- Encodings not to use? (cf. HTML 4.0) -IJ --> 1.434 - 1.435 - <h3 id=referring-to-characters-not-represented-><span class=secno>3.1. 1.436 - </span>Referring to characters not represented in a character encoding</h3> 1.437 - 1.438 - <p>A style sheet may have to refer to characters that cannot be represented 1.439 - in the current character encoding. These characters must be written as <a 1.440 - href="#character-escapes" title="backslash escapes">escaped</a> references 1.441 - to ISO 10646 characters. These escapes serve the same purpose as numeric 1.442 - character references in HTML or XML documents (see <a href="#HTML40" 1.443 - rel=biblioentry>[HTML40]<!--{{!HTML40}}--></a>, chapters 5 and 25). 1.444 - 1.445 - <p>The character escape mechanism should be used when only a few characters 1.446 - must be represented this way. If most of a style sheet requires escaping, 1.447 - authors should encode it with a more appropriate encoding (e.g., if the 1.448 - style sheet contains a lot of Greek characters, authors might use 1.449 - "ISO-8859-7" or "UTF-8"). 1.450 - 1.451 - <p>Intermediate processors using a different character encoding may 1.452 - translate these escaped sequences into byte sequences of that encoding. 1.453 - Intermediate processors must not, on the other hand, alter escape 1.454 - sequences that cancel the special meaning of an ASCII character. 1.455 - 1.456 - <p><a href="#conformance">Conforming user agents</a> must correctly map to 1.457 - Unicode all characters in any character encodings that they recognize (or 1.458 - they must behave as if they did). 1.459 - 1.460 - <p>For example, a style sheet transmitted as ISO-8859-1 (Latin-1) cannot 1.461 - contain Greek letters directly: "κουρος" 1.462 - (Greek: "kouros") has to be written as "\3BA\3BF\3C5\3C1\3BF\3C2". 1.463 - 1.464 - <div class=note> 1.465 - <p> <em><strong>Note.</strong> In HTML 4.0, numeric character references 1.466 - are interpreted in "style" attribute values but not in the content of the 1.467 - STYLE element. Because of this asymmetry, we recommend that authors use 1.468 - the CSS character escape mechanism rather than numeric character 1.469 - references for both the "style" attribute and the STYLE element. For 1.470 - example, we recommend:</em></p> 1.471 - 1.472 - <pre class=html-example> 1.473 -<span style="voice-family: D\FC rst">...</span> 1.474 -</pre> 1.475 - 1.476 - <p><em>rather than:</em></p> 1.477 - 1.478 - <pre class=html-example> 1.479 -<span style="voice-family: D&#252;rst">...</span> 1.480 -</pre> 1.481 - </div> 1.482 - 1.483 - <h3 id=the-textcss-content-type><span class=secno>3.2. </span>The <dfn 1.484 - id=textcss>text/css</dfn> content type</h3> 1.485 - 1.486 - <p>CSS style sheets that exist in separate files are sent over the Internet 1.487 - as a sequence of bytes accompanied by encoding 1.488 - information<!--(see [[!HTML40]], chapter 5)-->. The structure of the 1.489 - transmission, termed a <dfn id=message-entity 1.490 - title="message entity">message entity,</dfn> is defined by MIME and HTTP 1.491 - 1.1 (see <a href="#RFC2045" 1.492 - rel=biblioentry>[RFC2045]<!--{{!RFC2045}}--></a> and <a href="#HTTP11" 1.493 - rel=biblioentry>[HTTP11]<!--{{!HTTP11}}--></a>). A message entity with a 1.494 - content type of "text/css" represents an independent CSS style sheet. The 1.495 - "text/css" content type has been registered by RFC 2318 (<a 1.496 - href="#RFC2318" rel=biblioentry>[RFC2318]<!--{{!RFC2318}}--></a>). 1.497 - 1.498 - <h2 id=syntax><span class=secno>4. </span>General syntax of CSS</h2> 1.499 - 1.500 - <p>This section describes a grammar (and <dfn 1.501 - id=forward-compatible-parsing>forward-compatible parsing</dfn> rules) 1.502 - common to any version of CSS (including CSS3). Future versions of CSS will 1.503 - adhere to this core syntax, although they may add additional syntactic 1.504 - constraints. 1.505 - 1.506 - <p>See the <a href="#characters">section on characters and case</a> for 1.507 - information on case-sensitivity. 1.508 - 1.509 - <p>These descriptions are normative. 1.510 - 1.511 - <h3 id=characters><span class=secno>4.1. </span>Characters and case</h3> 1.512 - 1.513 - <p> The following rules always hold: 1.514 - 1.515 - <ul> 1.516 - <li> 1.517 - <p>All CSS style sheets are <span class=index id=case-insensitive 1.518 - title="case sensitivity">case-insensitive</span>, except for parts 1.519 - that are not under the control of CSS. For example, the case-sensitivity 1.520 - of values of the HTML attributes "id" and "class", of font names, and of 1.521 - URIs lies outside the scope of this specification. Note in particular 1.522 - that element names are case-insensitive in HTML, but case-sensitive in 1.523 - XML. 1.524 - 1.525 - <li> 1.526 - <p>In CSS3, <dfn id=identifiers title=identifier>identifiers</dfn> 1.527 - (including element names, classes, and IDs in selectors (see <a 1.528 - href="#SELECT" rel=biblioentry>[SELECT]<!--{{!SELECT}}--></a> <span 1.529 - class=issue>[or is this still true]</span>)) can contain only the 1.530 - characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, plus the 1.531 - hyphen (-) and the underscore (_); they cannot start with a digit or a 1.532 - hyphen followed by a digit. They can also contain escaped characters and 1.533 - any ISO 10646 character as a numeric code (see next item). <span 1.534 - class=example>For instance, the identifier "<code>B&W?</code>" may 1.535 - be written as "<code>B\&W\?</code>" or "<code>B\26 1.536 - W\3F</code>".</span> (See <a href="#UNICODE310" 1.537 - rel=biblioentry>[UNICODE310]<!--{{!UNICODE310}}--></a> and <a 1.538 - href="#ISO10646" rel=biblioentry>[ISO10646]<!--{{!ISO10646}}--></a>.) 1.539 - 1.540 - <li> 1.541 - <p>In CSS3, a backslash (\) character indicates three types of <dfn 1.542 - id=character-escapes title="backslash escapes">character escapes</dfn>.</p> 1.543 - 1.544 - <p>First, inside a string (see <a href="#CSS3VAL" 1.545 - rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a>), a backslash followed 1.546 - by a newline is ignored (i.e., the string is deemed not to contain 1.547 - either the backslash or the newline).</p> 1.548 - 1.549 - <p>Second, it cancels the meaning of special CSS characters. Any 1.550 - character (except a hexadecimal digit) can be escaped with a backslash 1.551 - to remove its special meaning. For example, <samp>"\""</samp> is a 1.552 - string consisting of one double quote. Style sheet preprocessors must 1.553 - not remove these backslashes from a style sheet since that would change 1.554 - the style sheet's meaning.</p> 1.555 - 1.556 - <p>Third, backslash escapes allow authors to refer to characters they 1.557 - can't easily put in a style sheet. In this case, the backslash is 1.558 - followed by at most six hexadecimal digits (0..9A..F), which stand for 1.559 - the ISO 10646 (<a href="#ISO10646" 1.560 - rel=biblioentry>[ISO10646]<!--{{!ISO10646}}--></a>) character with that 1.561 - number. If a digit or letter follows the hexadecimal number, the end of 1.562 - the number needs to be made clear. There are two ways to do that:</p> 1.563 - 1.564 - <ol> 1.565 - <li>with a space (or other whitespace character): "\26 B" ("&B"). In 1.566 - this case, user agents should treat a "CR/LF" pair (13/10) as a single 1.567 - whitespace character. 1.568 - 1.569 - <li>by providing exactly 6 hexadecimal digits: "\000026B" ("&B") 1.570 - </ol> 1.571 - 1.572 - <p>In fact, these two methods may be combined. Only one whitespace 1.573 - character is ignored after a hexadecimal escape. Note that this means 1.574 - that a "real" space after the escape sequence must itself either be 1.575 - escaped or doubled.</p> 1.576 - 1.577 - <li> 1.578 - <p>Backslash escapes are always considered to be part of an <a 1.579 - href="#identifiers">identifier</a> or a string (i.e., "\7B" is not 1.580 - punctuation, even though "{" is, and "\32" is allowed at the start of a 1.581 - class name, even though "2" is not). 1.582 - </ul> 1.583 - 1.584 - <h3 id=tokenization><span class=secno>4.2. </span>Tokenization</h3> 1.585 - 1.586 - <p class=issue>[This needs to be integrated with the selectors module. How 1.587 - should that be done?] 1.588 - 1.589 - <p>All levels of CSS — level 1, level 2, level 3, and any future 1.590 - levels — use the same core syntax. This allows UAs to parse (though 1.591 - not completely understand) style sheets written in levels of CSS that 1.592 - didn't exist at the time the UAs were created. Designers can use this 1.593 - feature to create style sheets that work with older user agents, while 1.594 - also exercising the possibilities of the latest levels of CSS. 1.595 - 1.596 - <p>At the lexical level, CSS style sheets consist of a sequence of tokens. 1.597 - Hexadecimal codes (e.g., <code>#x20</code>) refer to ISO 10646 (<a 1.598 - href="#ISO10646" rel=biblioentry>[ISO10646]<!--{{!ISO10646}}--></a>). In 1.599 - case of multiple matches, the longest match determines the token. 1.600 - 1.601 - <p>The following productions are <em>parts</em> of tokens: 1.602 - 1.603 - <p class=issue>[We need something to allow signs on integers. Do we need to 1.604 - go as far as css3-selectors?] 1.605 - 1.606 - <table> 1.607 - <tbody> 1.608 - <tr> 1.609 - <td id=SUBTOK-ident>ident 1.610 - 1.611 - <td>::= 1.612 - 1.613 - <td><code>'-'? <a href="#SUBTOK-nmstart">nmstart</a> <a 1.614 - href="#SUBTOK-nmchar">nmchar</a>*</code> 1.615 - 1.616 - <tr> 1.617 - <td id=SUBTOK-name>name 1.618 - 1.619 - <td>::= 1.620 - 1.621 - <td><code><a href="#SUBTOK-nmchar">nmchar</a>+</code> 1.622 - 1.623 - <tr> 1.624 - <td id=SUBTOK-nmstart>nmstart 1.625 - 1.626 - <td>::= 1.627 - 1.628 - <td><code>[a-zA-Z] | '_' | <a href="#SUBTOK-nonascii">nonascii</a> | <a 1.629 - href="#SUBTOK-escape">escape</a></code> 1.630 - 1.631 - <tr> 1.632 - <td id=SUBTOK-nonascii>nonascii 1.633 - 1.634 - <td>::= 1.635 - 1.636 - <td><code>[#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]</code> 1.637 - 1.638 - <tr> 1.639 - <td id=SUBTOK-unicode>unicode 1.640 - 1.641 - <td>::= 1.642 - 1.643 - <td><code>'\' [0-9a-fA-F]{1,6} <a href="#SUBTOK-wc">wc</a>?</code> 1.644 - 1.645 - <tr> 1.646 - <td id=SUBTOK-escape>escape 1.647 - 1.648 - <td>::= 1.649 - 1.650 - <td><code><a href="#SUBTOK-unicode">unicode</a> | '\' 1.651 - [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]</code> 1.652 - 1.653 - <tr> 1.654 - <td id=SUBTOK-nmchar>nmchar 1.655 - 1.656 - <td>::= 1.657 - 1.658 - <td><code>[a-zA-Z0-9] | '-' | '_' | <a 1.659 - href="#SUBTOK-nonascii">nonascii</a> | <a 1.660 - href="#SUBTOK-escape">escape</a></code> 1.661 - 1.662 - <tr> 1.663 - <td id=SUBTOK-num>num 1.664 - 1.665 - <td>::= 1.666 - 1.667 - <td><code>[0-9]+ | [0-9]* '.' [0-9]+</code> 1.668 - 1.669 - <tr> 1.670 - <td id=SUBTOK-string>string 1.671 - 1.672 - <td>::= 1.673 - 1.674 - <td><code>'"' (<a href="#SUBTOK-stringchar">stringchar</a> | "'")* '"' | 1.675 - "'" (<a href="#SUBTOK-stringchar">stringchar</a> | '"')* "'"</code> 1.676 - 1.677 - <tr> 1.678 - <td id=SUBTOK-stringchar>stringchar 1.679 - 1.680 - <td>::= 1.681 - 1.682 - <td><code><a href="#SUBTOK-urlchar">urlchar</a> | #x20 | '\' <a 1.683 - href="#SUBTOK-nl">nl</a></code> 1.684 - 1.685 - <tr> 1.686 - <td id=SUBTOK-urlchar>urlchar 1.687 - 1.688 - <td>::= 1.689 - 1.690 - <td><code>[#x9#x21#x23-#x26#x27-#x7E] | <a 1.691 - href="#SUBTOK-nonascii">nonascii</a> | <a 1.692 - href="#SUBTOK-escape">escape</a></code> 1.693 - 1.694 - <tr> 1.695 - <td id=SUBTOK-nl>nl 1.696 - 1.697 - <td>::= 1.698 - 1.699 - <td><code>#xA | #xD #xA | #xD | #xC</code> 1.700 - 1.701 - <tr> 1.702 - <td id=SUBTOK-w>w 1.703 - 1.704 - <td>::= 1.705 - 1.706 - <td><code><a href="#SUBTOK-wc">wc</a>*</code> 1.707 - 1.708 - <tr> 1.709 - <td id=SUBTOK-wc>wc 1.710 - 1.711 - <td>::= 1.712 - 1.713 - <td><code>#x9 | #xA | #xC | #xD | #x20</code> 1.714 - </table> 1.715 - 1.716 - <p>The following productions are the complete list of tokens in CSS3: 1.717 - 1.718 - <table> 1.719 - <tbody> 1.720 - <tr> 1.721 - <td id=TOK-IDENT>IDENT 1.722 - 1.723 - <td>::= 1.724 - 1.725 - <td><code><a href="#SUBTOK-ident">ident</a></code> 1.726 - 1.727 - <tr> 1.728 - <td id=TOK-ATKEYWORD>ATKEYWORD 1.729 - 1.730 - <td>::= 1.731 - 1.732 - <td><code>'@' <a href="#SUBTOK-ident">ident</a></code> 1.733 - 1.734 - <tr> 1.735 - <td id=TOK-STRING>STRING 1.736 - 1.737 - <td>::= 1.738 - 1.739 - <td><code><a href="#SUBTOK-string">string</a></code> 1.740 - 1.741 - <tr> 1.742 - <td id=TOK-HASH>HASH 1.743 - 1.744 - <td>::= 1.745 - 1.746 - <td><code>'#' <a href="#SUBTOK-name">name</a></code> 1.747 - 1.748 - <tr> 1.749 - <td id=TOK-NUMBER>NUMBER 1.750 - 1.751 - <td>::= 1.752 - 1.753 - <td><code><a href="#SUBTOK-num">num</a></code> 1.754 - 1.755 - <tr> 1.756 - <td id=TOK-PERCENTAGE>PERCENTAGE 1.757 - 1.758 - <td>::= 1.759 - 1.760 - <td><code><a href="#SUBTOK-num">num</a> '%'</code> 1.761 - 1.762 - <tr> 1.763 - <td id=TOK-DIMENSION>DIMENSION 1.764 - 1.765 - <td>::= 1.766 - 1.767 - <td><code><a href="#SUBTOK-num">num</a> <a 1.768 - href="#SUBTOK-ident">ident</a></code> 1.769 - 1.770 - <tr> 1.771 - <td id=TOK-URI>URI 1.772 - 1.773 - <td>::= 1.774 - 1.775 - <td><code>"url(" <a href="#SUBTOK-w">w</a> (<a 1.776 - href="#SUBTOK-string">string</a> | <a 1.777 - href="#SUBTOK-urlchar">urlchar</a>* ) <a href="#SUBTOK-w">w</a> 1.778 - ")"</code> 1.779 - 1.780 - <tr> 1.781 - <td id=TOK-UNICODE-RANGE>UNICODE-RANGE 1.782 - 1.783 - <td>::= 1.784 - 1.785 - <td><code>"U+" [0-9A-F?]{1,6} ('-' [0-9A-F]{1,6})?</code> 1.786 - 1.787 - <tr> 1.788 - <td id=TOK-CDO>CDO 1.789 - 1.790 - <td>::= 1.791 - 1.792 - <td><code>"<!--"</code> 1.793 - 1.794 - <tr> 1.795 - <td id=TOK-CDC>CDC 1.796 - 1.797 - <td>::= 1.798 - 1.799 - <td><code>"-->"</code> 1.800 - 1.801 - <tr> 1.802 - <td id=TOK-S>S 1.803 - 1.804 - <td>::= 1.805 - 1.806 - <td><code><a href="#SUBTOK-wc">wc</a>+</code> 1.807 - 1.808 - <tr> 1.809 - <td id=TOK-COMMENT>COMMENT 1.810 - 1.811 - <td>::= 1.812 - 1.813 - <td><code>"/*" [^*]* '*'+ ([^/] [^*]* '*'+)* "/"</code> 1.814 - 1.815 - <tr> 1.816 - <td id=TOK-FUNCTION>FUNCTION 1.817 - 1.818 - <td>::= 1.819 - 1.820 - <td><code><a href="#SUBTOK-ident">ident</a> '('</code> 1.821 - 1.822 - <tr> 1.823 - <td id=TOK-INCLUDES>INCLUDES 1.824 - 1.825 - <td>::= 1.826 - 1.827 - <td><code>"~="</code> 1.828 - 1.829 - <tr> 1.830 - <td id=TOK-DASHMATCH>DASHMATCH 1.831 - 1.832 - <td>::= 1.833 - 1.834 - <td><code>"|="</code> 1.835 - 1.836 - <tr> 1.837 - <td id=TOK-PREFIXMATCH>PREFIXMATCH 1.838 - 1.839 - <td>::= 1.840 - 1.841 - <td><code>"^="</code> 1.842 - 1.843 - <tr> 1.844 - <td id=TOK-SUFFIXMATCH>SUFFIXMATCH 1.845 - 1.846 - <td>::= 1.847 - 1.848 - <td><code>"$="</code> 1.849 - 1.850 - <tr> 1.851 - <td id=TOK-SUBSTRINGMATCH>SUBSTRINGMATCH 1.852 - 1.853 - <td>::= 1.854 - 1.855 - <td><code>"*="</code> 1.856 - 1.857 - <tr> 1.858 - <td id=TOK-CHAR>CHAR 1.859 - 1.860 - <td>::= 1.861 - 1.862 - <td>any other character not matched by the above rules, except for 1.863 - <code>"</code> or <code>'</code> 1.864 - 1.865 - <tr> 1.866 - <td id=TOK-BOM>BOM 1.867 - 1.868 - <td>::= 1.869 - 1.870 - <td><code>#xFEFF</code> 1.871 - </table> 1.872 - 1.873 - <p> Since any single character other than ‘<code class=css> or " that 1.874 - cannot be part of a larger token is a single character token, there cannot 1.875 - be errors in tokenization other than the inability to tokenize an 1.876 - unmatched quotation mark. If at some point it is not possible to continue 1.877 - tokenizing an incoming style sheet, the remainder of the style sheet 1.878 - should be ignored and only the largest initial segment of the style sheet 1.879 - that can be tokenized according to the above rules (that is, the entire 1.880 - style sheet except for the part from the unmatched (single or double) 1.881 - quotation mark to the end) should be used to form the sequence of tokens 1.882 - to be parsed according to the grammar. </code> 1.883 - 1.884 - <p class=issue>[This isn’t exactly right. Since the string token 1.885 - can't contain newlines that aren't escaped by backslashes, an 1.886 - untokenizable sequence can occur in the middle of a file. Would it be 1.887 - better to change things so that unmatched quotation marks become 1.888 - single-character tokens and all character streams are tokenizable?] 1.889 - 1.890 - <h3 id=grammar><span class=secno>4.3. </span>Grammar</h3> 1.891 - 1.892 - <h4 id=principles-of-css-error-handling><span class=secno>4.3.1. 1.893 - </span>Principles of CSS error handling</h4> 1.894 - 1.895 - <p>All levels of CSS, starting from CSS1, have required that user agents 1.896 - ignore certain types of invalid style sheets in well-defined ways. This 1.897 - allows forward-compatibility, since it allows future extensions to CSS 1.898 - within basic grammatical constraints that will be ignored in well-defined 1.899 - ways by user agents implementing earlier versions of CSS. 1.900 - 1.901 - <p>Handling of CSS that is not valid CSS3 but is valid according to the 1.902 - forward-compatible syntax requires first determining the beginning and end 1.903 - of the part that is invalid and then handling that part in a specified 1.904 - way. The latter is described in the <a href="#error-handling">rules for 1.905 - handling parsing errors</a>. The mechanism for the former is described 1.906 - within the grammar. 1.907 - 1.908 - <p>The handling of style sheets that do not parse according to the 1.909 - forward-compatible core syntax is not defined by this specification. <span 1.910 - class=issue>[Should it be?]</span> 1.911 - 1.912 - <p>Certain productions within the grammar are <dfn 1.913 - id=error-handling-points>error handling points</dfn>. Every error handling 1.914 - point has a backup production that is to be used if it is not possible to 1.915 - parse the stream of tokens based on the primary production. If the error 1.916 - handling production is represented as <code>prod</code>, then the backup 1.917 - production is represented as <code>FAIL(prod)</code>. 1.918 - 1.919 - <p class=issue>[The <a href="#detailed-grammar">grammar</a> given in 1.920 - Appendix D of CSS2 still needs to be incorporated into this specification. 1.921 - The editor hopes that it can be done by unifying it with the 1.922 - forward-compatible grammar into a single grammar that describes both the 1.923 - rules for forward-compatible parsing and the syntax of what is currently 1.924 - possible in CSS, but that may not be possible. However, hopefully it will 1.925 - be possible to do this by describing the general grammar in terms of the 1.926 - concepts described in the previous paragraph.] 1.927 - 1.928 - <p>Excluding the transformation of a production into its backup production, 1.929 - this grammar is LL(1). <span class=issue>[We should explain briefly what 1.930 - this means, except that it's probably not true. It's probably just 1.931 - LALR(1).]</span> 1.932 - 1.933 - <p>The portion of a CSS style sheet that is to be used is the largest 1.934 - initial stream of the tokens resulting from the <a 1.935 - href="#tokenization">tokenization process</a> that can be parsed according 1.936 - to the grammar presented in this chapter. (For example, if a brace closing 1.937 - a declaration block <span class=issue>[link-ify this]</span> is not 1.938 - present, the declaration block must be ignored since the closing brace is 1.939 - required to satisfy this grammar.) <span class=issue>[This might lead to 1.940 - highly unexpected behavior when there's an extra closing brace (etc.). Do 1.941 - we really want this?]</span> 1.942 - 1.943 - <p>Some of the constraints of CSS are not expressed in the grammar. For 1.944 - example, an <a href="#charset0"><code>@charset</code></a> rule is not 1.945 - permitted in an embedded style sheet, or a namespace prefix that has not 1.946 - been defined by an <code>@namespace</code> rule is an invalid selector. 1.947 - These constraints should be handled just as a parsing error would be (by 1.948 - ignoring out to the next backup production) unless specified otherwise. 1.949 - 1.950 - <h4 id=style-sheets><span class=secno>4.3.2. </span>Style sheets</h4> 1.951 - 1.952 - <p>Below is the core syntax for CSS. Lowercase identifiers represent 1.953 - productions in this grammar, uppercase identifiers represent tokens (see 1.954 - above), and characters in single quotes (‘<code class=css>) 1.955 - represent CHAR tokens (see above). The sections that follow describe how 1.956 - to use it.</code> 1.957 - 1.958 - <p class=issue>[This might need better integration with the selectors 1.959 - module, although maybe it’s ok.] 1.960 - 1.961 - <pre> 1.962 -stylesheet : [ CDO | CDC | S | statement ]*; 1.963 -statement : ruleset | at-rule; 1.964 -at-rule : ATKEYWORD S* any* [ block | ';' S* ]; 1.965 -block : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*; 1.966 -ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*; 1.967 -selector : any+; 1.968 -declaration : property ':' S* value; 1.969 -property : IDENT S*; 1.970 -value : [ any | block | ATKEYWORD S* ]+; 1.971 -any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING 1.972 - | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES 1.973 - | FUNCTION S* any* ')' | DASHMATCH | '(' S* any* ')' 1.974 - | '[' S* any* ']' ] S*; 1.975 -</pre> 1.976 - 1.977 - <div class=issue> [The definitions of these productions should be spread 1.978 - below into the prose describing what they mean. Furthermore, they should 1.979 - be combined with the Appendix D grammar from CSS2, perhaps using notation 1.980 - like: 1.981 - <table> 1.982 - <tbody> 1.983 - <tr> 1.984 - <td>ruleset 1.985 - 1.986 - <td>::= 1.987 - 1.988 - <td>... 1.989 - 1.990 - <tr> 1.991 - <td>FAIL(ruleset) 1.992 - 1.993 - <td>::= 1.994 - 1.995 - <td>... 1.996 - </table> 1.997 - ]</div> 1.998 - 1.999 - <p><dfn id=comment>COMMENT</dfn> tokens do not occur in the grammar (to 1.1000 - keep it readable), but any number of these tokens may appear anywhere 1.1001 - between other tokens. 1.1002 - 1.1003 - <p>The token S in the grammar above stands for <dfn 1.1004 - id=whitespace>whitespace</dfn>. Only the characters "space" (Unicode code 1.1005 - 32), "tab" (9), "line feed" (10), "carriage return" (13), and "form feed" 1.1006 - (12) can occur in whitespace. Other space-like characters, such as 1.1007 - "em-space" (8195) and "ideographic space" (12288), are never part of 1.1008 - whitespace. 1.1009 - 1.1010 - <h3 id=keywords><span class=secno>4.4. </span>Keywords</h3> 1.1011 - <!-- provide better explanation of where keywords appear: 1.1012 -media types, at-rules, etc. -IJ --> 1.1013 - 1.1014 - <p>Keywords have the form of identifiers. Keywords must not be placed 1.1015 - between quotes ("..." or ‘<code class=css>...</code>’). Thus, 1.1016 - 1.1017 - <pre> 1.1018 -red 1.1019 -</pre> 1.1020 - 1.1021 - <p>is a keyword, but 1.1022 - 1.1023 - <pre> 1.1024 -"red" 1.1025 -</pre> 1.1026 - 1.1027 - <p>is not. (It is a string.) Other illegal examples: 1.1028 - 1.1029 - <div class="illegal example"> 1.1030 - <p> 1.1031 - 1.1032 - <pre> 1.1033 -width: "auto"; 1.1034 -border: "none"; 1.1035 -background: "red"; 1.1036 -</pre> 1.1037 - </div> 1.1038 - 1.1039 - <h3 id=statements><span class=secno>4.5. </span>Statements</h3> 1.1040 - 1.1041 - <p>A CSS style sheet, for any version of CSS, consists of a list of <em 1.1042 - class=index id=statements0>statements</em> (see the grammar above). There 1.1043 - are two kinds of statements: <a href="#at-rules1"><em class=index 1.1044 - id=at-rules0>at-rules</em></a> and <em class=index id=rule-sets. 1.1045 - title="rule sets">rule sets.</em> There may be <a 1.1046 - href="#whitespace">whitespace</a> around the statements. 1.1047 - 1.1048 - <h3 id=at-rules><span class=secno>4.6. </span><dfn 1.1049 - id=at-rules1>At-rules</dfn></h3> 1.1050 - 1.1051 - <p> At-rules start with an <dfn id=at-keyword>at-keyword</dfn>, an 1.1052 - ‘<code class=css>@</code>’ character followed immediately by 1.1053 - an <a href="#identifiers">identifier</a> (for example, ‘<code 1.1054 - class=css>@import</code>’, ‘<code 1.1055 - class=css>@page</code>’). 1.1056 - 1.1057 - <p> An at-rule consists of everything up to and including the next 1.1058 - semicolon (;) or the next <a href="#block">block,</a> whichever comes 1.1059 - first. A CSS user agent that encounters an unrecognized or misplaced 1.1060 - at-rule must <a class=index href="#ignore8" id=ignore>ignore</a> the whole 1.1061 - of the at-rule and continue parsing after it. 1.1062 - 1.1063 - <div class="illegal example"> 1.1064 - <p> Assume, for example, that a CSS3 parser encounters this style sheet: 1.1065 - 1.1066 - <pre> 1.1067 -@import "subs.css"; 1.1068 -h1 { color: blue } 1.1069 -@import "list.css"; 1.1070 -</pre> 1.1071 - 1.1072 - <p>The second ‘<code class=css><code>@import</code></code>’ is 1.1073 - illegal according to CSS3 since ‘<code 1.1074 - class=css><code>@import</code></code>’ rules must occur before all 1.1075 - rules other than ‘<a href="#charset0"><code 1.1076 - class=css><code>@charset</code></code></a>’ rules. The CSS3 parser 1.1077 - <a class=index href="#ignore8" id=ignores title=ignore>ignores</a> the 1.1078 - whole at-rule, effectively reducing the style sheet to: 1.1079 - 1.1080 - <pre> 1.1081 -@import "subs.css"; 1.1082 -h1 { color: blue } 1.1083 -</pre> 1.1084 - </div> 1.1085 - 1.1086 - <div class="illegal example"> 1.1087 - <p> In the following example, the second ‘<code 1.1088 - class=css>@import</code>’ rule is invalid, since it occurs inside a 1.1089 - ‘<code class=css>@media</code>’ <a href="#block">block</a>. 1.1090 - 1.1091 - <pre> 1.1092 -@import "subs.css"; 1.1093 -@media print { 1.1094 - @import "print-main.css"; 1.1095 - BODY { font-size: 10pt } 1.1096 -} 1.1097 -h1 {color: blue } 1.1098 -</pre> 1.1099 - </div> 1.1100 - 1.1101 - <h3 id=blocks><span class=secno>4.7. </span><dfn id=blocks0>Blocks</dfn></h3> 1.1102 - 1.1103 - <p> A <span class=index id=block><em>block</em></span> starts with a left 1.1104 - curly brace ({) and ends with the matching right curly brace (}). In 1.1105 - between there may be any characters, except that parentheses (( )), 1.1106 - brackets ([ ]) and braces ({ }) must always occur in matching 1.1107 - pairs and may be nested. Single (‘<code class=css>) and double 1.1108 - quotes (") <!-- " --> must also occur in matching pairs, and characters 1.1109 - between them are parsed as a <span class=index id=string>string</span>. 1.1110 - See <a href="#tokenization">Tokenization</a> above for the definition of a 1.1111 - string. </code> 1.1112 - 1.1113 - <div class="illegal example"> 1.1114 - <p> Here is an example of a block. Note that the right brace between the 1.1115 - double quotes does not match the opening brace of the block, and that the 1.1116 - second single quote is an <a href="#character-escapes" 1.1117 - title="backslash escapes">escaped character</a>, and thus doesn’t 1.1118 - match the first single quote: 1.1119 - 1.1120 - <pre> 1.1121 -{ causta: "}" + ({7} * '\'') } 1.1122 -</pre> 1.1123 - 1.1124 - <p>Note that the above rule is not valid CSS3, but it is still a block as 1.1125 - defined above. 1.1126 - </div> 1.1127 - 1.1128 - <h3 id=rule-sets-declaration-blocks-and-selecto><span class=secno>4.8. 1.1129 - </span>Rule sets, declaration blocks, and selectors</h3> 1.1130 - 1.1131 - <p> A rule set (also called "rule") consists of a selector followed by a 1.1132 - declaration block. 1.1133 - 1.1134 - <p> A <dfn id=declaration-block>declaration-block</dfn> (also called a 1.1135 - {}-block in the following text) starts with a left curly brace ({) and 1.1136 - ends with the matching right curly brace (}). In between there must be a 1.1137 - list of zero or more semicolon-separated (;) declarations. 1.1138 - 1.1139 - <p>The <dfn id=selector>selector</dfn> (see the Selectors module <a 1.1140 - href="#SELECT" rel=biblioentry>[SELECT]<!--{{!SELECT}}--></a>) consists of 1.1141 - everything up to (but not including) the first left curly brace ({). A 1.1142 - selector always goes together with a {}-block. When a user agent can't 1.1143 - parse the selector (i.e., it is not valid CSS3), it must <a class=index 1.1144 - href="#ignore8" id=ignore0>ignore</a> the {}-block as well. 1.1145 - 1.1146 - <p>CSS3 gives a special meaning to the comma (,) in selectors. However, 1.1147 - since it is not known if the comma may acquire other meanings in future 1.1148 - versions of CSS, the whole statement should be <a class=index 1.1149 - href="#ignore8" id=ignored title=ignore>ignored</a> if there is an error 1.1150 - anywhere in the selector, even though the rest of the selector may look 1.1151 - reasonable in CSS3. 1.1152 - 1.1153 - <div class=illegal example> 1.1154 - <p>For example, since the "&" is not a valid token in a CSS3 selector, 1.1155 - a CSS3 user agent must <a class=index href="#ignore8" 1.1156 - id=ignore1>ignore</a> the whole second line, and not set the color of H3 1.1157 - to red: 1.1158 - 1.1159 - <pre> 1.1160 -h1, h2 {color: green } 1.1161 -h3, h4 & h5 {color: red } 1.1162 -h6 {color: black } 1.1163 -</pre> 1.1164 - </div> 1.1165 - 1.1166 - <div class=example> 1.1167 - <p> 1.1168 - 1.1169 - <p>Here is a more complex example. The first two pairs of curly braces are 1.1170 - inside a string, and do not mark the end of the selector. This is a valid 1.1171 - CSS3 statement. 1.1172 - 1.1173 - <pre> 1.1174 -p[example="public class foo\ 1.1175 -{\ 1.1176 - private int x;\ 1.1177 -\ 1.1178 - foo(int x) {\ 1.1179 - this.x = x;\ 1.1180 - }\ 1.1181 -\ 1.1182 -}"] { color: red } 1.1183 -</pre> 1.1184 - 1.1185 - <div class=note> 1.1186 - <p> <em><strong>Note.</strong> The <span class=css>\</span> characters in 1.1187 - the above example cause the newlines to be ignored. Newlines can be 1.1188 - placed in strings only using the correct numeric character escape. See 1.1189 - <a href="#characters">characters and case</a> above. </em> 1.1190 - </div> 1.1191 - </div> 1.1192 - 1.1193 - <h3 id=declarations><span class=secno>4.9. </span>Declarations and 1.1194 - properties</h3> 1.1195 - 1.1196 - <p> A <dfn id=declaration>declaration</dfn> is either empty or consists of 1.1197 - a <dfn id=property>property</dfn>, followed by a colon (:), followed by a 1.1198 - value. Around each of these there may be <a 1.1199 - href="#whitespace">whitespace</a>. 1.1200 - 1.1201 - <p>Because of the way selectors work, multiple declarations for the same 1.1202 - selector may be organized into semicolon (;) separated groups. 1.1203 - 1.1204 - <div class=example> 1.1205 - <p> Thus, the following rules:</p> 1.1206 - 1.1207 - <pre> 1.1208 -h1 { font-weight: bold } 1.1209 -h1 { font-size: 2em } 1.1210 -h1 { line-height: 1.2 } 1.1211 -h1 { font-family: Helvetica, Arial, sans-serif } 1.1212 -h1 { font-variant: normal } 1.1213 -h1 { font-style: normal } 1.1214 -</pre> 1.1215 - 1.1216 - <p>are equivalent to:</p> 1.1217 - 1.1218 - <pre> 1.1219 -h1 { 1.1220 - font-weight: bold; 1.1221 - font-size: 2em; 1.1222 - line-height: 1.2; 1.1223 - font-family: Helvetica, Arial, sans-serif; 1.1224 - font-variant: normal; 1.1225 - font-style: normal 1.1226 -} 1.1227 -</pre> 1.1228 - </div> 1.1229 - 1.1230 - <p>A property is an <a href="#identifiers">identifier</a>. Any character 1.1231 - may occur in the value, but parentheses ("( )"), brackets 1.1232 - ("[ ]"), braces ("{ }"), single quotes (‘<code class=css>) 1.1233 - and double quotes (") <!-- " --> must come in matching pairs, and 1.1234 - semicolons not in strings must be <a href="#character-escapes" 1.1235 - title="backslash escapes">escaped</a>. Parentheses, brackets, and braces 1.1236 - may be nested. Inside the quotes, characters are parsed as a string. 1.1237 - </code> 1.1238 - 1.1239 - <p>The syntax of <dfn id=values title=value>values</dfn> is specified 1.1240 - separately for each property, but in any case, values are built from 1.1241 - identifiers, strings, numbers, lengths, percentages, URIs, colors, angles, 1.1242 - times, and frequencies. 1.1243 - 1.1244 - <p>A user agent must <a class=index href="#ignore8" id=ignore2>ignore</a> a 1.1245 - declaration with an invalid property name or an invalid value. Every CSS3 1.1246 - property has its own syntactic and semantic restrictions on the values it 1.1247 - accepts. 1.1248 - 1.1249 - <div class="illegal example"> 1.1250 - <p> For example, assume a CSS3 parser encounters this style sheet: 1.1251 - 1.1252 - <pre> 1.1253 -h1 { color: red; font-style: 12px } /* Invalid value: 12px */ 1.1254 -p { color: blue; font-vendor: any; /* Invalid prop.: font-vendor */ 1.1255 - font-variant: small-caps } 1.1256 -em em { font-style: normal } 1.1257 -</pre> 1.1258 - 1.1259 - <p> The second declaration on the first line has an invalid value 1.1260 - ’12pt'. The second declaration on the second line contains an 1.1261 - undefined property ‘<code class=property>font-vendor</code>’. 1.1262 - The CSS3 parser will <a class=index href="#ignore8" id=ignore3>ignore</a> 1.1263 - these declarations, effectively reducing the style sheet to: 1.1264 - 1.1265 - <pre class=example> 1.1266 -h1 { color: red; } 1.1267 -p { color: blue; font-variant: small-caps } 1.1268 -em em { font-style: normal } 1.1269 -</pre> 1.1270 - </div> 1.1271 - 1.1272 - <h3 id=comments><span class=secno>4.10. </span><dfn 1.1273 - id=comments0>Comments</dfn></h3> 1.1274 - 1.1275 - <p><a class=index href="#comments0" id=comments->Comments </a> begin with 1.1276 - the characters "/*" and end with the characters "*/". They may occur 1.1277 - anywhere between tokens, and their contents have no influence on the 1.1278 - rendering. Comments may not be nested. 1.1279 - 1.1280 - <p>CSS also allows the SGML comment delimiters ("<!--" and "-->") in 1.1281 - certain places, but they do not delimit CSS comments. They are permitted 1.1282 - so that style rules appearing in an HTML source document (in the STYLE 1.1283 - element) may be hidden from pre-HTML 3.2 user agents. See the HTML 4.0 1.1284 - specification (<a href="#HTML40" 1.1285 - rel=biblioentry>[HTML40]<!--{{!HTML40}}--></a>) for more information. 1.1286 - 1.1287 - <h2 id=error-handling><span class=secno>5. </span>Rules for handling 1.1288 - parsing errors or unsupported features</h2> 1.1289 - 1.1290 - <p class=issue>[Hopefully (assuming it can be formalized within the rules 1.1291 - above) this section will not need so much detail and can be folded into 1.1292 - the previous section.] 1.1293 - 1.1294 - <p>In some cases, user agents must ignore part of an illegal style sheet. 1.1295 - This specification defines <dfn id=ignore4>ignore</dfn> to mean that the 1.1296 - user agent parses the illegal part according to the grammar above (in 1.1297 - order to find its beginning and end), but otherwise acts as if it had not 1.1298 - been there. 1.1299 - 1.1300 - <p>If a style sheet cannot be parsed according to the grammar above, the 1.1301 - user agent must behave the same as it would if the style sheet had the 1.1302 - smallest sequence of characters removed from its end that would allow it 1.1303 - to be parsed according to the grammar. 1.1304 - 1.1305 - <p>To ensure that new properties and new values for existing properties can 1.1306 - be added in the future, user agents are required to obey the following 1.1307 - rules when they encounter the following scenarios: 1.1308 - 1.1309 - <ul> 1.1310 - <li><strong>Unknown properties.</strong> User agents must <a class=index 1.1311 - href="#ignore8" id=ignore5>ignore</a> a <a 1.1312 - href="#declarations">declaration</a> with an unknown property. For 1.1313 - example, if the style sheet is: 1.1314 - <pre class="illegal example"> 1.1315 -h1 { color: red; rotation: 70minutes } 1.1316 -</pre> 1.1317 - 1.1318 - <p> the user agent will treat this as if the style sheet had been 1.1319 - 1.1320 - <pre class=example> 1.1321 -H1 { color: red } 1.1322 -</pre> 1.1323 - 1.1324 - <li id=illegalvalues><strong>Illegal values.</strong> User agents must 1.1325 - ignore a declaration with an illegal value. For example: 1.1326 - <pre class="illegal example"> 1.1327 -img { float: left } /* correct CSS3 */ 1.1328 -img { float: left here } /* "here" is not a value of 'float' */ 1.1329 -img { background: "red" } /* keywords cannot be quoted in CSS3 */ 1.1330 -img { border-width: 3 } /* a unit must be specified for length values */ 1.1331 -</pre> 1.1332 - A CSS3 parser would honor the first rule and <a class=index 1.1333 - href="#ignore8" id=ignore6>ignore</a> the rest, as if the style sheet had 1.1334 - been: 1.1335 - <pre class=example> 1.1336 -img { float: left } 1.1337 -img { } 1.1338 -img { } 1.1339 -img { } 1.1340 -</pre> 1.1341 - 1.1342 - <p>A user agent conforming to a future CSS specification may accept one 1.1343 - or more of the other rules as well.</p> 1.1344 - 1.1345 - <p class=issue>[A general comment on how to handle negative numbers when 1.1346 - disallowed might be useful. It should be a parsing error (and thus 1.1347 - ignored). We might want to add additional grammar productions for 1.1348 - potentially negative numbers.]</p> 1.1349 - 1.1350 - <li><strong>Malformed declarations.</strong> User agents must handle 1.1351 - unexpected tokens encountered while parsing a declaration by reading 1.1352 - until the end of the declaration, while observing the rules for matching 1.1353 - pairs of (), [], {}, "", and ‘<code class=css>, and correctly 1.1354 - handling escapes. For example, a malformed declaration may be missing a 1.1355 - property, colon (:) or value. The following are all equivalent: </code> 1.1356 - <pre class=example><code> 1.1357 -p { color:green } 1.1358 -p { color:green; color } /* malformed declaration missing ':', value */ 1.1359 -p { color:red; color; color:green } /* same with expected recovery */ 1.1360 -p { color:green; color: } /* malformed declaration missing value */ 1.1361 -p { color:red; color:; color:green } /* same with expected recovery */ 1.1362 -p { color:green; color{;color:maroon} } /* unexpected tokens { } */ 1.1363 -p { color:red; color{;color:maroon}; color:green } /* same with recovery */ 1.1364 -</code></pre> 1.1365 - 1.1366 - <li><strong>Invalid at-keywords.</strong> User agents must <a class=index 1.1367 - href="#ignore8" id=ignore7>ignore</a> an invalid at-keyword together with 1.1368 - everything following it, up to and including the next semicolon (;) or 1.1369 - block ({...}), whichever comes first. For example, consider the 1.1370 - following: 1.1371 - <pre class="illegal example"> 1.1372 -@three-dee { 1.1373 - @background-lighting { 1.1374 - azimuth: 30deg; 1.1375 - elevation: 190deg; 1.1376 - } 1.1377 - h1 { color: red } 1.1378 -} 1.1379 -h1 { color: blue } 1.1380 -</pre> 1.1381 - 1.1382 - <p> The '@three-dee' at-rule is not part of CSS3. Therefore, the whole 1.1383 - at-rule (up to, and including, the third right curly brace) is <a 1.1384 - class=index href="#ignore8" id=ignored. title=ignore>ignored.</a> A CSS3 1.1385 - user agent <a class=index href="#ignore8" id=ignores0 1.1386 - title=ignore>ignores</a> it, effectively reducing the style sheet to:</p> 1.1387 - 1.1388 - <pre class=example> 1.1389 -h1 { color: blue } 1.1390 -</pre> 1.1391 - 1.1392 - <li id=unsupportedvalues> 1.1393 - <p><strong>Unsupported Values</strong>If a UA does not support a 1.1394 - particular value, it should <a href="#ignore8"><em>ignore</em></a> that 1.1395 - value when parsing stylesheets, as if that value was an <a 1.1396 - href="#illegalvalues">illegal value</a>. For example:</p> 1.1397 - 1.1398 - <div class=example> 1.1399 - <pre> 1.1400 - h3 { 1.1401 - display: inline; 1.1402 - display: run-in; 1.1403 - } 1.1404 -</pre> 1.1405 - </div> 1.1406 - 1.1407 - <p> A UA that supports the 'run-in' value for the 'display' property will 1.1408 - accept the first display declaration and then "write over" that value 1.1409 - with the second display declaration. A UA that does not support the 1.1410 - 'run-in' value will process the first display declaration and ignore the 1.1411 - second display declaration.</p> 1.1412 - </ul> 1.1413 - 1.1414 - <h3 id=partial-implementations><span class=secno>5.1. </span>Partial 1.1415 - implementations</h3> 1.1416 - 1.1417 - <p>CSS3, unlike CSS1 and CSS2, is modular and thus allows for partial 1.1418 - implementations. The conformance requirements of some modules may also 1.1419 - allow for conformant implementations to implement only part of a module. 1.1420 - 1.1421 - <p>Implementations that do not implement a feature of any CSS3 module 1.1422 - (whether a property, an at-rule, or a property value) should behave as 1.1423 - they would according to the forward-compatible parsing rules had that 1.1424 - feature not been part of a known CSS specification. 1.1425 - 1.1426 - <h2 id=vendor-specific-extensions><span class=secno>6. 1.1427 - </span>Vendor-specific extensions</h2> 1.1428 - 1.1429 - <p>Although proprietary extensions should be avoided in general, there are 1.1430 - situations (experiments, implementations of W3C drafts that have not yet 1.1431 - reached Candidate Recommendation, intra-nets, debugging, etc.) where it is 1.1432 - convenient to add some nonstandard, i.e., proprietary identifiers to a CSS 1.1433 - style sheet. It is often hard to predict how long these proprietary 1.1434 - extensions will be in use and hard to avoid that their names clash with 1.1435 - new, standard properties or with other proprietary properties. Therefore 1.1436 - the CSS Working Group proposes the following simple naming convention. A 1.1437 - proprietary name should have a prefix consisting of: 1.1438 - 1.1439 - <ol> 1.1440 - <li>an underscore ("_") or a dash ("-"), 1.1441 - 1.1442 - <li>the (possibly abbreviated) name of the company, organization, etc. 1.1443 - that created it, 1.1444 - 1.1445 - <li>an underscore or a dash. 1.1446 - </ol> 1.1447 - 1.1448 - <p>Some examples (and the companies/organizations that created them): 1.1449 - 1.1450 - <ul> 1.1451 - <li><em>-moz-box-sizing,</em> <em>-moz-border-radius</em> (The Mozilla 1.1452 - Organization) 1.1453 - 1.1454 - <li><em>-wap-accesske</em>y (The WAP Forum) 1.1455 - 1.1456 - <li><em>_xyz-dwiw</em> (hypothetical) 1.1457 - </ul> 1.1458 - 1.1459 - <p>The advantage of the initial dash is that it is not a valid start 1.1460 - character for identifiers in CSS, so it is guaranteed never to be used by 1.1461 - any current or future level of CSS. CSS-conforming parsers will skip rules 1.1462 - that contain identifiers with such a character. <span class=issue>[Should 1.1463 - the grammar allow '-' as part of identifiers or should it require that 1.1464 - vendors who use '-' to begin identifiers extend the grammar in their 1.1465 - tokenizer? Currently it does, but perhaps it shouldn't.]</span> 1.1466 - 1.1467 - <p>That is also a possible disadvantage: a conforming parser will skip 1.1468 - them, so in order to use them, an extended parser is required. 1.1469 - 1.1470 - <p>For that reason, the underscore is also proposed. Although it is a valid 1.1471 - start character, the CSS Working Group believes it will never define any 1.1472 - identifiers that start with that character. 1.1473 - 1.1474 - <h3 id=historical-notes><span class=secno>6.1. </span>Historical notes</h3> 1.1475 - 1.1476 - <p><em>This section is informative, not normative.</em> 1.1477 - 1.1478 - <p>Microsoft created a number of proprietary properties for use inside 1.1479 - their Microsoft Office product, at a time when there was not yet a 1.1480 - consensus in the working group about the naming convention. They chose to 1.1481 - prefix properties with "mso-" rather than "-mso-". 1.1482 - 1.1483 - <p>At the time of writing, the following prefixes are known to exist: 1.1484 - 1.1485 - <ul> 1.1486 - <li><em>mso-</em> (Microsoft Corporation) 1.1487 - 1.1488 - <li><em>-moz-</em> (The Mozilla Organization) 1.1489 - 1.1490 - <li><em>-o-</em> (Opera Software) 1.1491 - 1.1492 - <li><em>-atsc</em>- (Advanced Television Standards Committee) 1.1493 - 1.1494 - <li><em>-wap-</em> (The WAP Forum) 1.1495 - </ul> 1.1496 - 1.1497 - <h2 id=conf><span class=secno>7. </span>Conformance</h2> 1.1498 - 1.1499 - <p>The key words <dfn id=must>"MUST"</dfn>, <dfn id=must-not>"MUST 1.1500 - NOT"</dfn>, <dfn id=required>"REQUIRED"</dfn>, <dfn 1.1501 - id=shall>"SHALL"</dfn>, <dfn id=shall-not>"SHALL NOT"</dfn>, <dfn 1.1502 - id=should>"SHOULD"</dfn>, <dfn id=should-not>"SHOULD NOT"</dfn>, <dfn 1.1503 - id=recommended>"RECOMMENDED"</dfn>, <dfn id=may>"MAY"</dfn>, and <dfn 1.1504 - id=optional>"OPTIONAL"</dfn> in this document are to be interpreted as 1.1505 - described in RFC 2119 (see <a href="#RFC2119" 1.1506 - rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>). However, for 1.1507 - readability, these words do not appear in all uppercase letters in this 1.1508 - specification. 1.1509 - 1.1510 - <h3 id=definitions><span class=secno>7.1. </span>Definitions</h3> 1.1511 - 1.1512 - <p class=issue>[Some of these need heavy rewriting given modularization. 1.1513 - I've avoided substituting CSS3 where it's clearly not going to be 1.1514 - appropriate.] 1.1515 - 1.1516 - <p>This module and other CSS3 modules rely on the following definitions: 1.1517 - 1.1518 - <dl> 1.1519 - <dt><dfn id=style-sheet>Style sheet</dfn> 1.1520 - 1.1521 - <dd>A set of statements that specify presentation of a document. 1.1522 - <p>Style sheets may have three different origins: <a 1.1523 - href="#author">author</a>, <a href="#user">user</a>, and <a 1.1524 - href="#user-agent">user agent</a>. The interaction of these sources is 1.1525 - described in the cascading and inheritance module <a href="#CSS3CASCADE" 1.1526 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>.</p> 1.1527 - 1.1528 - <dt><dfn id=valid-style-sheet>Valid style sheet</dfn> 1.1529 - 1.1530 - <dd>The validity of a style sheet depends on the level of CSS used for the 1.1531 - style sheet. All valid CSS1 style sheets are valid CSS 2.1 style 1.1532 - sheets, but some changes from CSS1 mean that a few CSS1 style sheets will 1.1533 - have slightly different semantics in CSS 2.1. Some features in CSS2 1.1534 - are not part of CSS 2.1, so not all CSS2 style sheets are valid 1.1535 - CSS 2.1 style sheets. 1.1536 - <p>A valid CSS 2.1 style sheet must be written according to the <a 1.1537 - href="#detailed-grammar">grammar of CSS 2.1</a>. Furthermore, it 1.1538 - must contain only at-rules, property names, and property values defined 1.1539 - in this specification. An <dfn id=illegal>illegal</dfn> (invalid) 1.1540 - at-rule, property name, or property value is one that is not valid. 1.1541 - 1.1542 - <dt><dfn id=ignore8>Ignore</dfn> 1.1543 - 1.1544 - <dd>This term has three slightly different meanings in this specification. 1.1545 - First, a CSS parser must follow certain rules when it discovers unknown 1.1546 - or illegal syntax in a style sheet. The parser must then ignore certain 1.1547 - parts of the style sheets. The exact rules for what parts must be ignored 1.1548 - is given in these section: <a href="#declaration">Declarations and 1.1549 - properties</a>, <a href="#error-handling">Rules for handling parsing 1.1550 - errors</a>, <a href="#unsupportedvalues">Unsupported Values</a>, or may 1.1551 - be explained in the text where the term "ignore" appears. Second, a user 1.1552 - agent may (and, in some cases must) disregard certain properties or 1.1553 - values in the style sheet even if the syntax is legal. For example, 1.1554 - table-column-group elements cannot have borders around them, so the 1.1555 - border properties must be ignored. 1.1556 - 1.1557 - <dt><dfn id=author>Author</dfn> 1.1558 - 1.1559 - <dd>An author is a person who writes documents and associated style 1.1560 - sheets. An <dfn id=authoring-tool>authoring tool</dfn> generates 1.1561 - documents and associated style sheets. 1.1562 - 1.1563 - <dt><dfn id=user>User</dfn> 1.1564 - 1.1565 - <dd> A user is a person who interacts with a user agent to view, hear, or 1.1566 - otherwise use a document and its associated style sheet. The user may 1.1567 - provide a personal style sheet that encodes personal preferences. 1.1568 - 1.1569 - <dt><dfn id=user-agent-ua>User agent (UA)</dfn> 1.1570 - 1.1571 - <dd>A <dfn id=user-agent title="user agent|UA">user agent</dfn> is any 1.1572 - program that interprets a document written in the document language and 1.1573 - applies associated style sheets according to the terms of this 1.1574 - specification. A user agent may display a document, read it aloud, cause 1.1575 - it to be printed, convert it to another format, etc. 1.1576 - 1.1577 - <dd>An HTML user agent is one that supports the HTML 2.x, HTML 3.x, or 1.1578 - HTML 4.x specifications. A user agent that supports XHTML <a 1.1579 - href="#XHTML10" rel=biblioentry>[XHTML10]<!--{{XHTML10}}--></a>, but not 1.1580 - HTML (as listed in the previous sentence) is not considered an HTML user 1.1581 - agent for the purpose of conformance with this specification. 1.1582 - </dl> 1.1583 - 1.1584 - <h3 id=conf-UA><span class=secno>7.2. </span>User agent conformance</h3> 1.1585 - 1.1586 - <p class=issue>[This section should contain rules for user style sheet 1.1587 - conformance, author style sheet disabling, handling parsing errors, etc., 1.1588 - from the CSS2.1 specification.] 1.1589 - 1.1590 - <h4 id=error-conditions><span class=secno>7.2.1. </span>Error conditions</h4> 1.1591 - 1.1592 - <p>In general, this document does not specify error handling behavior for 1.1593 - user agents (e.g., how they behave when they cannot find a resource 1.1594 - designated by a URI). 1.1595 - 1.1596 - <p>However, user agents must observe the <a href="#error-handling">rules 1.1597 - for handling parsing errors</a>. 1.1598 - 1.1599 - <p>Since user agents may vary in how they handle error conditions, authors 1.1600 - and users must not rely on specific error recovery behavior. 1.1601 - 1.1602 - <h3 id=conf-SS><span class=secno>7.3. </span>Style sheet conformance</h3> 1.1603 - 1.1604 - <h3 id=conf-AT><span class=secno>7.4. </span>Authoring tool conformance</h3> 1.1605 - 1.1606 - <p>Authoring tools may use a modified form of the <a 1.1607 - href="#error-handling">rules for handling parsing errors</a>: when those 1.1608 - rules require that user agents <a href="#ignore8"><em>ignore</em></a> 1.1609 - something, authoring tools are not required to ignore it. However, 1.1610 - authoring tools should not present such parts of the style sheet to the 1.1611 - user in the same way as valid parts of the style sheet. In so far as 1.1612 - authoring tools display the application of a style sheet to a document, 1.1613 - they are required to meet the <a href="#conf-UA">user agent 1.1614 - conformance</a> rules. 1.1615 - 1.1616 - <p class=issue>[informative reference to canonicalization proposal?] 1.1617 - 1.1618 - <h2 id=property-defs><span class=secno>8. </span>Format of property 1.1619 - definitions in other modules</h2> 1.1620 - 1.1621 - <p>Each CSS property definition begins with a summary of key information 1.1622 - that resembles the following: 1.1623 - 1.1624 - <div class=propdef> 1.1625 - <dl> 1.1626 - <dt><dfn class=propdef-title id=property-name>'property-name'</dfn> 1.1627 - 1.1628 - <dd> 1.1629 - <table cellpadding=0 cellspacing=0 class=propinfo> 1.1630 - <tbody> 1.1631 - <tr valign=baseline> 1.1632 - <td><a href="#values"><em>Value:</em></a> 1.1633 - 1.1634 - <td>legal values & syntax 1.1635 - 1.1636 - <tr valign=baseline> 1.1637 - <td><em>Initial:</em> 1.1638 - 1.1639 - <td>initial value 1.1640 - 1.1641 - <tr valign=baseline> 1.1642 - <td><em>Applies to:</em> 1.1643 - 1.1644 - <td>elements this property applies to 1.1645 - 1.1646 - <tr valign=baseline> 1.1647 - <td><em>Inherited:</em> 1.1648 - 1.1649 - <td>whether the property is inherited 1.1650 - 1.1651 - <tr valign=baseline> 1.1652 - <td><em>Computed Value:</em> 1.1653 - 1.1654 - <td>the computed value of the property 1.1655 - 1.1656 - <tr valign=baseline> 1.1657 - <td><em>Percentages:</em> 1.1658 - 1.1659 - <td>how percentage values are interpreted 1.1660 - 1.1661 - <tr valign=baseline> 1.1662 - <td><em>Media:</em> 1.1663 - 1.1664 - <td>which media groups the property applies to 1.1665 - </table> 1.1666 - </dl> 1.1667 - </div> 1.1668 - 1.1669 - <h3 id=property-def-value><span class=secno>8.1. </span>Value</h3> 1.1670 - 1.1671 - <p>This part specifies the set of valid values for the property. Value 1.1672 - types may be designated in several ways: 1.1673 - 1.1674 - <ol> 1.1675 - <li> keyword values (e.g., auto, disc, etc.) 1.1676 - 1.1677 - <li> basic data types, which appear between "<" and ">" (e.g., 1.1678 - <length>, <percentage>, etc.). In the electronic version of 1.1679 - the document, each instance of a basic data type links to its definition. 1.1680 - 1.1681 - 1.1682 - <li> types that have the same range of values as a property bearing the 1.1683 - same name (e.g., <'border-width'> <'background-attachment'>, 1.1684 - etc.). In this case, the type name is the property name (complete with 1.1685 - quotes) between "<" and ">" (e.g., <'border-width'>). Such a 1.1686 - type does <strong>not</strong> include the value 'inherit'. In the 1.1687 - electronic version of the document, each instance of this type of 1.1688 - non-terminal links to the corresponding property definition. 1.1689 - 1.1690 - <li> non-terminals that do not share the same name as a property. In this 1.1691 - case, the non-terminal name appears between "<" and ">", as in 1.1692 - <border-width>. Notice the distinction between <border-width> 1.1693 - and <'border-width'>; the latter is defined in terms of the former. 1.1694 - The definition of a non-terminal is located near its first appearance in 1.1695 - the specification. In the electronic version of the document, each 1.1696 - instance of this type of value links to the corresponding value 1.1697 - definition. 1.1698 - </ol> 1.1699 - 1.1700 - <p>Other words in these definitions are keywords that must appear 1.1701 - literally, without quotes (e.g., red). The slash (/) and the comma (,) 1.1702 - must also appear literally. 1.1703 - 1.1704 - <p>Values may be arranged as follows: 1.1705 - 1.1706 - <ul> 1.1707 - <li>Several juxtaposed words mean that all of them must occur, in the 1.1708 - given order. 1.1709 - 1.1710 - <li>A bar (|) separates two or more alternatives: exactly one of them must 1.1711 - occur. 1.1712 - 1.1713 - <li>A double bar (||) separates two or more options: one or more of them 1.1714 - must occur, in any order. 1.1715 - 1.1716 - <li>Brackets ([ ]) are for grouping. 1.1717 - </ul> 1.1718 - 1.1719 - <p>Juxtaposition is stronger than the double bar, and the double bar is 1.1720 - stronger than the bar. Thus, the following lines are equivalent: 1.1721 - 1.1722 - <pre> 1.1723 - a b | c || d e 1.1724 - [ a b ] | [ c || [ d e ]] 1.1725 -</pre> 1.1726 - 1.1727 - <p> Every type, keyword, or bracketed group may be followed by one of the 1.1728 - following modifiers: 1.1729 - 1.1730 - <ul> 1.1731 - <li> An asterisk (*) indicates that the preceding type, word, or group 1.1732 - occurs zero or more times. 1.1733 - 1.1734 - <li> A plus (+) indicates that the preceding type, word, or group occurs 1.1735 - one or more times. 1.1736 - 1.1737 - <li> A question mark (?) indicates that the preceding type, word, or group 1.1738 - is optional. 1.1739 - 1.1740 - <li> A pair of numbers in curly braces ({A,B}) indicates that the 1.1741 - preceding type, word, or group occurs at least A and at most B times. 1.1742 - </ul> 1.1743 - 1.1744 - <p>The following examples illustrate different value types: 1.1745 - 1.1746 - <blockquote> 1.1747 - <p><a href="#values"><em>Value:</em></a> N | NW | NE<br> 1.1748 - <a href="#values"><em>Value:</em></a> [ <length> | thick | thin 1.1749 - ]{1,4}<br> 1.1750 - <a href="#values"><em>Value:</em></a> [<family-name> , ]* 1.1751 - <family-name><br> 1.1752 - <a href="#values"><em>Value:</em></a> <uri>? <color> [ / 1.1753 - <color> ]?<br> 1.1754 - <a href="#values"><em>Value:</em></a> <uri> || <color><br> 1.1755 - </blockquote> 1.1756 - 1.1757 - <p>See the values and units <a href="#CSS3VAL" 1.1758 - rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a> module for the formal 1.1759 - definitions of the basic values types. 1.1760 - 1.1761 - <p class=issue>[We need a more formal grammar for parsing of properties. 1.1762 - Refer to section on keywords (they can't be quoted).] 1.1763 - 1.1764 - <h4 id=initial-and-inherit-values><span class=secno>8.1.1. 1.1765 - </span><code>initial</code> and <code>inherit</code> values</h4> 1.1766 - 1.1767 - <p>In addition to the legal values stated, <code>initial</code> and 1.1768 - <code>inherit</code> values are also legal for every property. The meaning 1.1769 - of these values is described in the Values & Units <a href="#CSS3VAL" 1.1770 - rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a> and Cascading & 1.1771 - Inheritance <a href="#CSS3CASCADE" 1.1772 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a> modules. 1.1773 - 1.1774 - <h3 id=property-def-initial><span class=secno>8.2. </span>Initial</h3> 1.1775 - 1.1776 - <p>This part specifies the property's initial value. If the property is <a 1.1777 - href="#property-def-inherited">inherited</a>, this is the value that is 1.1778 - given to the root element of the <span>document tree</span>. Please 1.1779 - consult the the Cascading & Inheritance module <a href="#CSS3CASCADE" 1.1780 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a> for information 1.1781 - about the interaction between style sheet-specified, inherited, and 1.1782 - initial values. 1.1783 - 1.1784 - <h3 id=property-def-applies><span class=secno>8.3. </span>Applies to</h3> 1.1785 - 1.1786 - <p>This part lists the elements to which the property applies. All elements 1.1787 - are considered to have all properties, but some properties have no 1.1788 - rendering effect on some types of elements. For example, <span 1.1789 - class=propinst-white-space>'white-space'</span> only affects block-level 1.1790 - elements. 1.1791 - 1.1792 - <h3 id=property-def-inherited><span class=secno>8.4. </span>Inherited</h3> 1.1793 - 1.1794 - <p>This part indicates whether the value of the property is inherited from 1.1795 - an ancestor element by default ("Inherited: yes") or the value of the 1.1796 - property is its <a href="#property-def-initial">initial value</a> by 1.1797 - default ("Inherited: no"). Please consult the Cascading & Inheritance 1.1798 - Module <a href="#CSS3CASCADE" 1.1799 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a> for information 1.1800 - about the interaction between style sheet-specified, inherited, and 1.1801 - initial values. 1.1802 - 1.1803 - <h3 id=property-def-computed><span class=secno>8.5. </span>Computed value</h3> 1.1804 - 1.1805 - <p>This part indicates the computed value of the property. The concept of 1.1806 - computed value is described in the Cascading & Inheritance Module <a 1.1807 - href="#CSS3CASCADE" 1.1808 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>. (It is needed 1.1809 - both for inheritance and for the definitions of some DOM properties.) 1.1810 - 1.1811 - <p>When the computed value line says "as specified", then for the special 1.1812 - <span>'initial'</span> and <span>'inherit'</span> values, the computed 1.1813 - value is as though the initial value or the inherited value had been 1.1814 - specified -- it is not 'initial' or 'inherit' itself. <span 1.1815 - class=issue>[Check this with the definition of "specified value". It may 1.1816 - not be needed.]<span></span></span> 1.1817 - 1.1818 - <p class=issue>[What is the computed value for elements to which the 1.1819 - property does not apply? Do some existing inherited properties rely on 1.1820 - inheritance through elements to which the property doesn't apply?] 1.1821 - 1.1822 - <h3 id=property-def-percent><span class=secno>8.6. </span>Percentage values</h3> 1.1823 - 1.1824 - <p>This part indicates how percentages should be interpreted, if they occur 1.1825 - in the value of the property. If "N/A" appears here, it means that the 1.1826 - property does not accept percentages as values. 1.1827 - 1.1828 - <h3 id=media-groups><span class=secno>8.7. </span>Media groups</h3> 1.1829 - 1.1830 - <p class=issue>[Some of this needs to be relaxed to deal with profiles.] 1.1831 - 1.1832 - <p><em>This section is informative, not normative.</em> 1.1833 - 1.1834 - <p>This part indicates the media groups for which the property must be 1.1835 - implemented by a conforming user agent. Since properties generally apply 1.1836 - to several media, the "Applies to media" section of each property 1.1837 - definition lists media groups rather than individual media types. User 1.1838 - agents must support the property if they support rendering to the media 1.1839 - types included in these media groups. Each property applies to all media 1.1840 - types in the media groups listed in its definition. 1.1841 - 1.1842 - <p>CSS3 defines the following media groups: 1.1843 - 1.1844 - <ul> 1.1845 - <li> <dfn id=continuous title="'continuous' media group">continuous</dfn> 1.1846 - or <dfn id=paged title="'paged' media group">paged</dfn>. 1.1847 - 1.1848 - <li><dfn id=visual title="'visual' media group">visual,</dfn> <dfn 1.1849 - id=audio title="'audio' media group">audio,</dfn> <dfn id=speech 1.1850 - title="'speech' media group">speech,</dfn> or <dfn id=tactile 1.1851 - title="'tactile' media group">tactile</dfn>. 1.1852 - 1.1853 - <li><dfn id=grid title="'grid' media group">grid</dfn> (for character grid 1.1854 - devices), or <dfn id=bitmap title="'bitmap' media group">bitmap</dfn>. 1.1855 - 1.1856 - <li><dfn id=interactive 1.1857 - title="'interactive' media group">interactive</dfn> (for devices that 1.1858 - allow user interaction), or <dfn id=static 1.1859 - title="'static' media group">static</dfn> (for those that don't). 1.1860 - 1.1861 - <li><dfn id=all title="'all' media group">all</dfn> (includes all media 1.1862 - types) 1.1863 - </ul> 1.1864 - 1.1865 - <p>The following table shows the relationships between media groups and 1.1866 - media types: 1.1867 - 1.1868 - <table border summary="Relationship between media groups and media types"> 1.1869 - <caption>Relationship between media groups and media types</caption> 1.1870 - 1.1871 - <tbody> 1.1872 - <tr> 1.1873 - <th>Media Types 1.1874 - 1.1875 - <th colspan=4>Media Groups 1.1876 - 1.1877 - <tr> 1.1878 - <th> 1.1879 - 1.1880 - <th>continuous/paged 1.1881 - 1.1882 - <th>visual/audio/speech/tactile 1.1883 - 1.1884 - <th>grid/bitmap 1.1885 - 1.1886 - <th>interactive/static <!-- 1.1887 -<TR><TH>audio<TD align="center">continuous<TD align="center">audio<TD align="center">N/A<TD align="center">both</TR> 1.1888 ---> 1.1889 - 1.1890 - 1.1891 - <tr> 1.1892 - <th>braille 1.1893 - 1.1894 - <td align=center>continuous 1.1895 - 1.1896 - <td align=center>tactile 1.1897 - 1.1898 - <td align=center>grid 1.1899 - 1.1900 - <td align=center>both 1.1901 - 1.1902 - <tr> 1.1903 - <th>embossed 1.1904 - 1.1905 - <td align=center>paged 1.1906 - 1.1907 - <td align=center>tactile 1.1908 - 1.1909 - <td align=center>grid 1.1910 - 1.1911 - <td align=center>static 1.1912 - 1.1913 - <tr> 1.1914 - <th>handheld 1.1915 - 1.1916 - <td align=center>both 1.1917 - 1.1918 - <td align=center>visual, audio, speech 1.1919 - 1.1920 - <td align=center>both 1.1921 - 1.1922 - <td align=center>both 1.1923 - 1.1924 - <tr> 1.1925 - <th>print 1.1926 - 1.1927 - <td align=center>paged 1.1928 - 1.1929 - <td align=center>visual 1.1930 - 1.1931 - <td align=center>bitmap 1.1932 - 1.1933 - <td align=center>static 1.1934 - 1.1935 - <tr> 1.1936 - <th>projection 1.1937 - 1.1938 - <td align=center>paged 1.1939 - 1.1940 - <td align=center>visual 1.1941 - 1.1942 - <td align=center>bitmap 1.1943 - 1.1944 - <td align=center>interactive 1.1945 - 1.1946 - <tr> 1.1947 - <th>screen 1.1948 - 1.1949 - <td align=center>continuous 1.1950 - 1.1951 - <td align=center>visual, audio 1.1952 - 1.1953 - <td align=center>bitmap 1.1954 - 1.1955 - <td align=center>both 1.1956 - 1.1957 - <tr> 1.1958 - <th>speech 1.1959 - 1.1960 - <td align=center>continuous 1.1961 - 1.1962 - <td align=center>speech 1.1963 - 1.1964 - <td align=center>N/A 1.1965 - 1.1966 - <td align=center>both 1.1967 - 1.1968 - <tr> 1.1969 - <th>tty 1.1970 - 1.1971 - <td align=center>continuous 1.1972 - 1.1973 - <td align=center>visual 1.1974 - 1.1975 - <td align=center>grid 1.1976 - 1.1977 - <td align=center>both 1.1978 - 1.1979 - <tr> 1.1980 - <th>tv 1.1981 - 1.1982 - <td align=center>both 1.1983 - 1.1984 - <td align=center>visual, audio 1.1985 - 1.1986 - <td align=center>bitmap 1.1987 - 1.1988 - <td align=center>both 1.1989 - </table> 1.1990 - 1.1991 - <h3 id=shorthand-properties><span class=secno>8.8. </span>Shorthand 1.1992 - properties</h3> 1.1993 - 1.1994 - <p>Some properties are <dfn id=shorthand-properties0 1.1995 - title="shorthand property">shorthand properties</dfn>, meaning they allow 1.1996 - authors to specify the values of several properties with a single 1.1997 - property. 1.1998 - 1.1999 - <p>For instance, the <span class=propinst-font>'font'</span> property is a 1.2000 - shorthand property for setting <span 1.2001 - class=propinst-font-style>'font-style'</span>, <span 1.2002 - class=propinst-font-variant>'font-variant'</span>, <span 1.2003 - class=propinst-font-weight>'font-weight'</span>, <span 1.2004 - class=propinst-font-size>'font-size'</span>, <span 1.2005 - class=propinst-line-height>'line-height'</span>, and <span 1.2006 - class=propinst-font-family>'font-family'</span> all at once. 1.2007 - 1.2008 - <p>The syntax of a shorthand property may allow some of the properties that 1.2009 - can be specified by that shorthand to be omitted. When such values are 1.2010 - omitted from a shorthand form, each "missing" property is assigned its 1.2011 - initial value (see the Cascading & Inheritance module <a 1.2012 - href="#CSS3CASCADE" 1.2013 - rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>). The definition 1.2014 - of a shorthand property may further say that it resets the definitions of 1.2015 - other properties to their initial value. 1.2016 - 1.2017 - <div class=example> 1.2018 - <p> The multiple style rules of this example:</p> 1.2019 - 1.2020 - <pre> 1.2021 -h1 { 1.2022 - font-weight: bold; 1.2023 - font-size: 2em; 1.2024 - line-height: 1.2; 1.2025 - font-family: Helvetica, Arial, sans-serif; 1.2026 - font-variant: normal; 1.2027 - font-style: normal; 1.2028 - font-stretch: normal; 1.2029 - font-size-adjust: none 1.2030 -} 1.2031 -</pre> 1.2032 - 1.2033 - <p>may be rewritten with a single shorthand property:</p> 1.2034 - 1.2035 - <pre> 1.2036 -h1 { font: bold 2em/1.2 Helvetica, Arial, sans-serif } 1.2037 -</pre> 1.2038 - 1.2039 - <p>In this example, <span 1.2040 - class=propinst-font-variant>'font-variant'</span>, <span 1.2041 - class=propinst-font-stretch>'font-stretch'</span>, <span 1.2042 - class=propinst-font-size-adjust>'font-size-adjust'</span>, and <span 1.2043 - class=propinst-font-style>'font-style'</span> take their initial values.</p> 1.2044 - </div> 1.2045 - 1.2046 - <h2 id=detailed-grammar><span class=secno>9. </span>Appendix: Second 1.2047 - grammar</h2> 1.2048 - 1.2049 - <p class=issue>[This grammar was the Appendix D grammar of CSS2, augmented 1.2050 - by the additions from the @namespace draft. It needs to be incorporated 1.2051 - into the above normative text in some way.] 1.2052 - 1.2053 - <p>The grammar below defines the syntax of CSS2. It is in some sense, 1.2054 - however, a superset of CSS2 as this specification imposes additional 1.2055 - semantic constraints not expressed in this grammar. A conforming UA must 1.2056 - also adhere to the <a href="#syntax"> forward-compatible parsing 1.2057 - rules</a>, the <a href="#property-defs">property and value notation</a>, 1.2058 - and the unit notation. In addition, the document language may impose 1.2059 - restrictions, e.g. HTML imposes restrictions on the possible values of the 1.2060 - "class" attribute.</p> 1.2061 - <!-- IJ: There used to be a link to "unit notation", but I couldn't 1.2062 -find anything in the spec that corresponded. --> 1.2063 - 1.2064 - <h3 id=grammar0><span class=secno>9.1. </span>Grammar</h3> 1.2065 - 1.2066 - <p>The grammar below is <span class=index id=ll1 title="LL(1)">LL(1)</span> 1.2067 - (but note that most UA's should not use it directly, since it doesn't 1.2068 - express the forward-compatible <a href="#syntax">parsing conventions</a>, 1.2069 - only the CSS3 syntax). The format of the productions is optimized for 1.2070 - human consumption and some shorthand notation beyond Yacc (see <a 1.2071 - href="#YACC" rel=biblioentry>[YACC]<!--{{YACC}}--></a>) is used: 1.2072 - 1.2073 - <p class=issue>[It's probably not LL(1), but rather just LALR(1).] 1.2074 - 1.2075 - <p class=issue>[This needs a lot more revisions to reflect all the 1.2076 - additions in CSS3.] 1.2077 - 1.2078 - <p class=issue>[This doesn't allow nested at-rules, such as 1.2079 - <code>@page</code> inside <code>@media</code>. Do we want to allow this?] 1.2080 - 1.2081 - <ul> 1.2082 - <li><strong>*</strong>: 0 or more 1.2083 - 1.2084 - <li><strong>+</strong>: 1 or more 1.2085 - 1.2086 - <li><strong>?</strong>: 0 or 1 1.2087 - 1.2088 - <li><strong>|</strong>: separates alternatives 1.2089 - 1.2090 - <li><strong>[ ]</strong>: grouping 1.2091 - </ul> 1.2092 - 1.2093 - <p>The productions are: 1.2094 - 1.2095 - <pre> 1.2096 -stylesheet 1.2097 - : [ CHARSET_SYM S* STRING S* ';' ]? 1.2098 - [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* 1.2099 - [ namespace [S|CDO|CDC]* ]* 1.2100 - [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]* 1.2101 - ; 1.2102 -import 1.2103 - : IMPORT_SYM S* 1.2104 - [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S* 1.2105 - ; 1.2106 -namespace 1.2107 - : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* 1.2108 - ; 1.2109 -namespace_prefix 1.2110 - : IDENT 1.2111 - ; 1.2112 -media 1.2113 - : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S* 1.2114 - ; 1.2115 -medium 1.2116 - : IDENT S* 1.2117 - ; 1.2118 -page 1.2119 - : PAGE_SYM S* IDENT? pseudo_page? S* 1.2120 - '{' S* declaration [ ';' S* declaration ]* '}' S* 1.2121 - ; 1.2122 -pseudo_page 1.2123 - : ':' IDENT 1.2124 - ; 1.2125 -font_face 1.2126 - : FONT_FACE_SYM S* 1.2127 - '{' S* declaration [ ';' S* declaration ]* '}' S* 1.2128 - ; 1.2129 -operator 1.2130 - : '/' S* | ',' S* | /* empty */ 1.2131 - ; 1.2132 -combinator 1.2133 - : '+' S* | '>' S* | /* empty */ 1.2134 - ; 1.2135 -unary_operator 1.2136 - : '-' | '+' 1.2137 - ; 1.2138 -property 1.2139 - : IDENT S* 1.2140 - ; 1.2141 -ruleset 1.2142 - : selector [ ',' S* selector ]* 1.2143 - '{' S* declaration [ ';' S* declaration ]* '}' S* 1.2144 - ; 1.2145 -<a 1.2146 - class=index href="#selector" id=selector0>selector</a> 1.2147 - : simple_selector [ combinator simple_selector ]* 1.2148 - ; 1.2149 -simple_selector 1.2150 - : element_name? [ HASH | class | attrib | pseudo ]* S* 1.2151 - ; 1.2152 -class 1.2153 - : '.' IDENT 1.2154 - ; 1.2155 -element_name 1.2156 - : IDENT | '*' 1.2157 - ; 1.2158 -attrib 1.2159 - : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* 1.2160 - [ IDENT | STRING ] S* ]? ']' 1.2161 - ; 1.2162 -pseudo 1.2163 - : ':' [ IDENT | FUNCTION S* IDENT S* ')' ] 1.2164 - ; 1.2165 -declaration 1.2166 - : property ':' S* expr prio? 1.2167 - | /* empty */ 1.2168 - ; 1.2169 -prio 1.2170 - : IMPORTANT_SYM S* 1.2171 - ; 1.2172 -expr 1.2173 - : term [ operator term ]* 1.2174 - ; 1.2175 -term 1.2176 - : unary_operator? 1.2177 - [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* | 1.2178 - TIME S* | FREQ S* | function ] 1.2179 - | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor 1.2180 - ; 1.2181 -function 1.2182 - : FUNCTION S* expr ')' S* 1.2183 - ; 1.2184 -/* 1.2185 - * There is a constraint on the <span 1.2186 - class=index id=color>color</span> that it must 1.2187 - * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) 1.2188 - * after the "#"; e.g., "#000" is OK, but "#abcd" is not. 1.2189 - */ 1.2190 -hexcolor 1.2191 - : HASH S* 1.2192 - ; 1.2193 -</pre> 1.2194 - 1.2195 - <h3 id=lexical-scanner><span class=secno>9.2. </span>Lexical scanner</h3> 1.2196 - 1.2197 - <p> The following is the <dfn id=tokenizer>tokenizer</dfn>, written in Flex 1.2198 - (see <a href="#FLEX" rel=biblioentry>[FLEX]<!--{{FLEX}}--></a>) notation. 1.2199 - The tokenizer is case-insensitive. 1.2200 - 1.2201 - <p>The two occurrences of "\377" represent the highest character number 1.2202 - that current versions of Flex can deal with (decimal 255). They should be 1.2203 - read as "\4177777" (decimal 1114111), which is the highest possible code 1.2204 - point in <span class=index id=unicode>Unicode</span>/<span class=index 1.2205 - id=iso-10646>ISO-10646</span>, except excluding the characters excluded in 1.2206 - the <code><a href="#SUBTOK-nonascii">nonascii</a></code> production above.</p> 1.2207 - <!-- ignored whitespace after Unicode escape, is it OK? --> 1.2208 - 1.2209 - <pre> 1.2210 -%option case-insensitive 1.2211 - 1.2212 -h [0-9a-f] 1.2213 -nonascii [\200-\377] 1.2214 -unicode \\{h}{1,6}[ \t\r\n\f]? 1.2215 -escape {unicode}|\\[ -~\200-\377] 1.2216 -nmstart [a-z]|{nonascii}|{escape} 1.2217 -nmchar [a-z0-9-]|{nonascii}|{escape} 1.2218 -string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\" 1.2219 -string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\' 1.2220 - 1.2221 -ident [-]?{nmstart}{nmchar}* 1.2222 -name {nmchar}+ 1.2223 -num [0-9]+|[0-9]*"."[0-9]+ 1.2224 -string {string1}|{string2} 1.2225 -url ([!#$%&*-~]|{nonascii}|{escape})* 1.2226 -w [ \t\r\n\f]* 1.2227 -nl \n|\r\n|\r|\f 1.2228 -range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h}))))) 1.2229 - 1.2230 -%% 1.2231 - 1.2232 -[ \t\r\n\f]+ {return S;} 1.2233 - 1.2234 -\/\*[^*]*\*+([^/][^*]*\*+)*\/ /* ignore comments */ 1.2235 - 1.2236 -"<!--" {return CDO;} 1.2237 -"-->" {return CDC;} 1.2238 -"~=" {return INCLUDES;} 1.2239 -"|=" {return DASHMATCH;} 1.2240 - 1.2241 -{string} {return STRING;} 1.2242 - 1.2243 -{ident} {return IDENT;} 1.2244 - 1.2245 -"#"{name} {return HASH;} 1.2246 - 1.2247 -"@import" {return IMPORT_SYM;} 1.2248 -"@page" {return PAGE_SYM;} 1.2249 -"@media" {return MEDIA_SYM;} 1.2250 -"@font-face" {return FONT_FACE_SYM;} 1.2251 -"@charset" {return CHARSET_SYM;} 1.2252 -"@namespace" {return NAMESPACE_SYM;} 1.2253 - 1.2254 -"!{w}important" {return IMPORTANT_SYM;} 1.2255 - 1.2256 -{num}em {return EMS;} 1.2257 -{num}ex {return EXS;} 1.2258 -{num}px {return LENGTH;} 1.2259 -{num}cm {return LENGTH;} 1.2260 -{num}mm {return LENGTH;} 1.2261 -{num}in {return LENGTH;} 1.2262 -{num}pt {return LENGTH;} 1.2263 -{num}pc {return LENGTH;} 1.2264 -{num}deg {return ANGLE;} 1.2265 -{num}rad {return ANGLE;} 1.2266 -{num}grad {return ANGLE;} 1.2267 -{num}ms {return TIME;} 1.2268 -{num}s {return TIME;} 1.2269 -{num}Hz {return FREQ;} 1.2270 -{num}kHz {return FREQ;} 1.2271 -{num}{ident} {return DIMEN;} 1.2272 -{num}% {return PERCENTAGE;} 1.2273 -{num} {return NUMBER;} 1.2274 - 1.2275 -"url("{w}{string}{w}")" {return URI;} 1.2276 -"url("{w}{url}{w}")" {return URI;} 1.2277 -{ident}"(" {return FUNCTION;} 1.2278 - 1.2279 -U\+{range} {return UNICODERANGE;} 1.2280 -U\+{h}{1,6}-{h}{1,6} {return UNICODERANGE;} 1.2281 - 1.2282 -. {return *yytext;} 1.2283 -</pre> 1.2284 - 1.2285 - <h2 class=no-num id=changes-from-css2>Changes from CSS2</h2> 1.2286 - 1.2287 - <p>This section is informative. 1.2288 - 1.2289 - <p> The parts of CSS2 that have become part of this CSS3 draft are sections 1.2290 - 1.3.2 (1.4.2 in CSS 2.1), 1.3.3 (1.4.3 in CSS2.1), 3 (parts), 4.1, 4.2, 1.2291 - 4.4, and 6.3, 7, and Appendix D. This draft also contains new material on 1.2292 - namespaces and on vendor extensions to CSS that began as separate 1.2293 - documents. 1.2294 - 1.2295 - <ul> 1.2296 - <li>The text taken from Chapter 1 of CSS2 is now normative rather than 1.2297 - informative. 1.2298 - 1.2299 - <li>added the section on vendor extensions and added the <span 1.2300 - class=css>'-'</span> character to the ident productions so that 1.2301 - identifiers can begin with it 1.2302 - 1.2303 - <li>modified the rules for handling parsing errors to allow 1.2304 - implementations that support only parts of CSS3 1.2305 - 1.2306 - <li>described how style sheets that cannot be parsed according to the 1.2307 - grammar should be handled (by saying that parsing uses the parseable 1.2308 - initial sequence of tokens) 1.2309 - 1.2310 - <li><span class=issue>[to be done]</span> described handling of unmatched 1.2311 - quotation marks (by saying that tokenization uses the tokenizable initial 1.2312 - sequence of characters) 1.2313 - 1.2314 - <li><span class=issue>[to be done]</span> formalized the error handling 1.2315 - rules by combining the forward-compatible grammar in chapter 4 with the 1.2316 - CSS2 grammar in Appendix D. 1.2317 - 1.2318 - <li>combined DELIM and other single character tokens into CHAR 1.2319 - 1.2320 - <li>explicitly stated that the byte order mark should be ignored for 1.2321 - purposes of the grammar 1.2322 - 1.2323 - <li>Changed the acceptable characters to exclude surrogate blocks and 1.2324 - #xFFFE, #xFFFF, as in XML. 1.2325 - 1.2326 - <li>Changed the rules on what to do when a character encoding is not 1.2327 - specified. 1.2328 - </ul> 1.2329 - 1.2330 - <h2 class=no-num id=acknowledgments>Acknowledgments</h2> 1.2331 - 1.2332 - <p>Since most of this draft is taken from CSS2, it would not have been 1.2333 - possible to write it so easily without the work of the editors and authors 1.2334 - of <a href="#CSS1" rel=biblioentry>[CSS1]<!--{{CSS1}}--></a> and <a 1.2335 - href="#CSS2" rel=biblioentry>[CSS2]<!--{{CSS2}}--></a>. This draft also 1.2336 - borrows heavily from earlier drafts on CSS namespace support by Peter 1.2337 - Linss <a href="#CSS3NAMESPACE" 1.2338 - rel=biblioentry>[CSS3NAMESPACE]<!--{{CSS3NAMESPACE}}--></a> and early 1.2339 - (unpublished) drafts on vendor extensions to CSS by Bert Bos. Many current 1.2340 - and former members of the working group have contributed to this document. 1.2341 - Discussions on <code><a 1.2342 - href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a></code> 1.2343 - and in other places have also contributed ideas to this specification. 1.2344 - Comments from Glenn Adams, Björn Höhrmann, and Etan Wexler have 1.2345 - been particularly helpful. 1.2346 - 1.2347 - <h2 class=no-num id=references>References</h2> 1.2348 - 1.2349 - <h3 class=no-num id=normative-references>Normative references</h3> 1.2350 - <!--begin-normative--> 1.2351 - <!-- Sorted by label --> 1.2352 - 1.2353 - <dl class=bibliography> 1.2354 - <dt style="display: none"><!-- keeps the doc valid if the DL is empty --> 1.2355 - <!----> 1.2356 - 1.2357 - <dt id=CSS3CASCADE>[CSS3CASCADE] 1.2358 - 1.2359 - <dd>Håkon Wium Lie. <a 1.2360 - href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215"><cite>CSS3 1.2361 - module: Cascading and inheritance.</cite></a> 15 December 2005. W3C 1.2362 - Working Draft. (Work in progress.) URL: <a 1.2363 - href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215">http://www.w3.org/TR/2005/WD-css3-cascade-20051215</a> 1.2364 - </dd> 1.2365 - <!----> 1.2366 - 1.2367 - <dt id=CSS3VAL>[CSS3VAL] 1.2368 - 1.2369 - <dd>Håkon Wium Lie; Tab Atkins; Elika J. Etemad. <a 1.2370 - href="http://www.w3.org/TR/2012/WD-css3-values-20120308/"><cite>CSS 1.2371 - Values and Units Module Level 3.</cite></a> 8 March 2012. W3C Working 1.2372 - Draft. (Work in progress.) URL: <a 1.2373 - href="http://www.w3.org/TR/2012/WD-css3-values-20120308/">http://www.w3.org/TR/2012/WD-css3-values-20120308/</a> 1.2374 - </dd> 1.2375 - <!----> 1.2376 - 1.2377 - <dt id=HTML40>[HTML40] 1.2378 - 1.2379 - <dd>Ian Jacobs; David Raggett; Arnaud Le Hors. <a 1.2380 - href="http://www.w3.org/TR/1998/REC-html40-19980424"><cite>HTML 4.0 1.2381 - Specification.</cite></a> 24 April 1998. W3C Recommendation. URL: <a 1.2382 - href="http://www.w3.org/TR/1998/REC-html40-19980424">http://www.w3.org/TR/1998/REC-html40-19980424</a> 1.2383 - </dd> 1.2384 - <!----> 1.2385 - 1.2386 - <dt id=HTTP11>[HTTP11] 1.2387 - 1.2388 - <dd>R. Fielding; et al. <a 1.2389 - href="ftp://ftp.isi.edu/in-notes/rfc2616.txt"><cite>Hypertext Transfer 1.2390 - Protocol - HTTP/1.1.</cite></a> June 1999. Internet RFC 2616. URL: <a 1.2391 - href="ftp://ftp.isi.edu/in-notes/rfc2616.txt">ftp://ftp.isi.edu/in-notes/rfc2616.txt</a> 1.2392 - </dd> 1.2393 - <!----> 1.2394 - 1.2395 - <dt id=ISO10646>[ISO10646] 1.2396 - 1.2397 - <dd><cite>Information Technology - Universal Multiple- Octet Coded 1.2398 - CharacterSet (UCS) - Part 1: Architecture and Basic Multilingual 1.2399 - Plane.</cite> ISO/IEC10646-1:1993. The current specification also takes 1.2400 - into consideration the first five amendments to ISO/IEC 10646-1:1993. 1.2401 - Useful <a 1.2402 - href="http://www.egt.ie/standards/iso10646/ucs-roadmap.html">roadmaps</a>show 1.2403 - which scripts sit at which numeric ranges.</dd> 1.2404 - <!----> 1.2405 - 1.2406 - <dt id=RFC2045>[RFC2045] 1.2407 - 1.2408 - <dd>N. Freed and N. Borenstein. <a 1.2409 - href="http://www.ietf.org/rfc/rfc2045.txt"><cite>Multipurpose Internet 1.2410 - Mail Extensions (MIME) Part One: Format of Internet Message 1.2411 - Bodies.</cite></a> November 1996. URL: <a 1.2412 - href="http://www.ietf.org/rfc/rfc2045.txt">http://www.ietf.org/rfc/rfc2045.txt</a> 1.2413 - </dd> 1.2414 - <!----> 1.2415 - 1.2416 - <dt id=RFC2119>[RFC2119] 1.2417 - 1.2418 - <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key 1.2419 - words for use in RFCs to Indicate Requirement Levels.</cite></a> Internet 1.2420 - RFC 2119. URL: <a 1.2421 - href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 1.2422 - </dd> 1.2423 - <!----> 1.2424 - 1.2425 - <dt id=RFC2318>[RFC2318] 1.2426 - 1.2427 - <dd>H. Lie; B. Bos; C. Lilley. <a 1.2428 - href="http://www.ietf.org/rfc/rfc2318.txt"><cite>The text/css Media 1.2429 - Type.</cite></a> March 1998. URL: <a 1.2430 - href="http://www.ietf.org/rfc/rfc2318.txt">http://www.ietf.org/rfc/rfc2318.txt</a> 1.2431 - </dd> 1.2432 - <!----> 1.2433 - 1.2434 - <dt id=RFC2978>[RFC2978] 1.2435 - 1.2436 - <dd>N. Freed; J. Postel. <a 1.2437 - href="http://www.ietf.org/rfc/rfc2978.txt"><cite>IANA Charset 1.2438 - Registration Procedures.</cite></a> October 2000. Internet RFC 2978. URL: 1.2439 - <a 1.2440 - href="http://www.ietf.org/rfc/rfc2978.txt">http://www.ietf.org/rfc/rfc2978.txt</a> 1.2441 - </dd> 1.2442 - <!----> 1.2443 - 1.2444 - <dt id=SELECT>[SELECT] 1.2445 - 1.2446 - <dd>Tantek Çelik; et al. <a 1.2447 - href="http://www.w3.org/TR/2011/REC-css3-selectors-20110929/"><cite>Selectors 1.2448 - Level 3.</cite></a> 29 September 2011. W3C Recommendation. URL: <a 1.2449 - href="http://www.w3.org/TR/2011/REC-css3-selectors-20110929/">http://www.w3.org/TR/2011/REC-css3-selectors-20110929/</a> 1.2450 - </dd> 1.2451 - <!----> 1.2452 - 1.2453 - <dt id=UNICODE310>[UNICODE310] 1.2454 - 1.2455 - <dd>The Unicode Consortium. <a 1.2456 - href="http://www.unicode.org/unicode/standard/versions/enumeratedversions.html#Unicode_3_1_0"><cite>The 1.2457 - Unicode Standard: Version 3.1.0.</cite></a> Addison Wesley Longman. 2000. 1.2458 - ISBN 0-201-61633-5. For more information, consult the Unicode 1.2459 - Consortium's home page at <a 1.2460 - href="http://www.unicode.org/">http://www.unicode.org/</a> 1.2461 - URL: <a 1.2462 - href="http://www.unicode.org/unicode/standard/versions/enumeratedversions.html#Unicode_3_1_0">http://www.unicode.org/unicode/standard/versions/enumeratedversions.html#Unicode_3_1_0</a> 1.2463 - </dd> 1.2464 - <!----> 1.2465 - </dl> 1.2466 - <!--end-normative--> 1.2467 - 1.2468 - <h3 class=no-num id=other-references>Other references</h3> 1.2469 - <!--begin-informative--> 1.2470 - <!-- Sorted by label --> 1.2471 - 1.2472 - <dl class=bibliography> 1.2473 - <dt style="display: none"><!-- keeps the doc valid if the DL is empty --> 1.2474 - <!----> 1.2475 - 1.2476 - <dt id=CHARSETS>[CHARSETS] 1.2477 - 1.2478 - <dd><a 1.2479 - href="http://www.iana.org/assignments/character-sets"><cite>Characters 1.2480 - sets.</cite></a> These are the official names for character sets that may 1.2481 - be used in the Internet and may be referred to in Internet documentation 1.2482 - URL: <a 1.2483 - href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a> 1.2484 - </dd> 1.2485 - <!----> 1.2486 - 1.2487 - <dt id=CSS1>[CSS1] 1.2488 - 1.2489 - <dd>Håkon Wium Lie; Bert Bos. <a 1.2490 - href="http://www.w3.org/TR/2008/REC-CSS1-20080411"><cite>Cascading Style 1.2491 - Sheets (CSS1) Level 1 Specification.</cite></a> 11 April 2008. W3C 1.2492 - Recommendation. URL: <a 1.2493 - href="http://www.w3.org/TR/2008/REC-CSS1-20080411">http://www.w3.org/TR/2008/REC-CSS1-20080411</a> 1.2494 - </dd> 1.2495 - <!----> 1.2496 - 1.2497 - <dt id=CSS2>[CSS2] 1.2498 - 1.2499 - <dd>Ian Jacobs; et al. <a 1.2500 - href="http://www.w3.org/TR/2008/REC-CSS2-20080411"><cite>Cascading Style 1.2501 - Sheets, level 2 (CSS2) Specification.</cite></a> 11 April 2008. W3C 1.2502 - Recommendation. URL: <a 1.2503 - href="http://www.w3.org/TR/2008/REC-CSS2-20080411">http://www.w3.org/TR/2008/REC-CSS2-20080411</a> 1.2504 - </dd> 1.2505 - <!----> 1.2506 - 1.2507 - <dt id=CSS3NAMESPACE>[CSS3NAMESPACE] 1.2508 - 1.2509 - <dd>Elika J. Etemad; Anne van Kesteren. <a 1.2510 - href="http://www.w3.org/TR/2011/REC-css3-namespace-20110929/"><cite>CSS 1.2511 - Namespaces Module.</cite></a> 29 September 2011. W3C Recommendation. URL: 1.2512 - <a 1.2513 - href="http://www.w3.org/TR/2011/REC-css3-namespace-20110929/">http://www.w3.org/TR/2011/REC-css3-namespace-20110929/</a> 1.2514 - </dd> 1.2515 - <!----> 1.2516 - 1.2517 - <dt id=CSS3PAGE>[CSS3PAGE] 1.2518 - 1.2519 - <dd>Håkon Wium Lie; Melinda Grant. <a 1.2520 - href="http://www.w3.org/TR/2006/WD-css3-page-20061010"><cite>CSS3 Module: 1.2521 - Paged Media.</cite></a> 10 October 2006. W3C Working Draft. (Work in 1.2522 - progress.) URL: <a 1.2523 - href="http://www.w3.org/TR/2006/WD-css3-page-20061010">http://www.w3.org/TR/2006/WD-css3-page-20061010</a> 1.2524 - </dd> 1.2525 - <!----> 1.2526 - 1.2527 - <dt id=CSS3SPEECH>[CSS3SPEECH] 1.2528 - 1.2529 - <dd>Daniel Weck. <a 1.2530 - href="http://www.w3.org/TR/2012/CR-css3-speech-20120320/"><cite>CSS 1.2531 - Speech Module.</cite></a> 20 March 2012. W3C Candidate Recommendation. 1.2532 - (Work in progress.) URL: <a 1.2533 - href="http://www.w3.org/TR/2012/CR-css3-speech-20120320/">http://www.w3.org/TR/2012/CR-css3-speech-20120320/</a> 1.2534 - </dd> 1.2535 - <!----> 1.2536 - 1.2537 - <dt id=CSSSTYLEATTR>[CSSSTYLEATTR] 1.2538 - 1.2539 - <dd>Tantek Çelik; Elika J. Etemad. <a 1.2540 - href="http://www.w3.org/TR/2010/CR-css-style-attr-20101012/"><cite>CSS 1.2541 - Style Attributes.</cite></a> 12 October 2010. W3C Candidate 1.2542 - Recommendation. (Work in progress.) URL: <a 1.2543 - href="http://www.w3.org/TR/2010/CR-css-style-attr-20101012/">http://www.w3.org/TR/2010/CR-css-style-attr-20101012/</a> 1.2544 - </dd> 1.2545 - <!----> 1.2546 - 1.2547 - <dt id=FLEX>[FLEX] 1.2548 - 1.2549 - <dd><cite>Flex: The Lexical Scanner Generator.</cite> Version 2.3.7, ISBN 1.2550 - 1882114213</dd> 1.2551 - <!----> 1.2552 - 1.2553 - <dt id=MEDIAQ>[MEDIAQ] 1.2554 - 1.2555 - <dd>Håkon Wium Lie; et al. <a 1.2556 - href="http://www.w3.org/TR/2010/CR-css3-mediaqueries-20100727/"><cite>Media 1.2557 - Queries.</cite></a> 27 July 2010. W3C Candidate Recommendation. (Work in 1.2558 - progress.) URL: <a 1.2559 - href="http://www.w3.org/TR/2010/CR-css3-mediaqueries-20100727/">http://www.w3.org/TR/2010/CR-css3-mediaqueries-20100727/</a> 1.2560 - </dd> 1.2561 - <!----> 1.2562 - 1.2563 - <dt id=XHTML10>[XHTML10] 1.2564 - 1.2565 - <dd>Steven Pemberton. <a 1.2566 - href="http://www.w3.org/TR/2002/REC-xhtml1-20020801"><cite>XHTML™ 1.2567 - 1.0 The Extensible HyperText Markup Language (Second Edition).</cite></a> 1.2568 - 1 August 2002. W3C Recommendation. URL: <a 1.2569 - href="http://www.w3.org/TR/2002/REC-xhtml1-20020801">http://www.w3.org/TR/2002/REC-xhtml1-20020801</a> 1.2570 - </dd> 1.2571 - <!----> 1.2572 - 1.2573 - <dt id=XML10>[XML10] 1.2574 - 1.2575 - <dd>C. M. Sperberg-McQueen; et al. <a 1.2576 - href="http://www.w3.org/TR/2008/REC-xml-20081126/"><cite>Extensible 1.2577 - Markup Language (XML) 1.0 (Fifth Edition).</cite></a> 26 November 2008. 1.2578 - W3C Recommendation. URL: <a 1.2579 - href="http://www.w3.org/TR/2008/REC-xml-20081126/">http://www.w3.org/TR/2008/REC-xml-20081126/</a> 1.2580 - </dd> 1.2581 - <!----> 1.2582 - 1.2583 - <dt id=YACC>[YACC] 1.2584 - 1.2585 - <dd>S. C. Johnson. <cite>YACC - Yet another compiler compiler.</cite> 1.2586 - Murray Hill. 1975. Technical Report.</dd> 1.2587 - <!----> 1.2588 - </dl> 1.2589 - <!--end-informative--> 1.2590 - 1.2591 - <h2 class=no-num id=index>Index</h2> 1.2592 - <!--begin-index--> 1.2593 - 1.2594 - <ul class=indexlist> 1.2595 - <li>'all' media group, <a href="#all" 1.2596 - title="'all' media group"><strong>8.7.</strong></a> 1.2597 - 1.2598 - <li>at-keyword, <a href="#at-keyword" 1.2599 - title=at-keyword><strong>4.6.</strong></a> 1.2600 - 1.2601 - <li>at-rules, <a href="#at-rules0" title=at-rules>4.5.</a>, <a 1.2602 - href="#at-rules1" title=At-rules><strong>4.6.</strong></a> 1.2603 - 1.2604 - <li>'audio' media group, <a href="#audio" 1.2605 - title="'audio' media group"><strong>8.7.</strong></a> 1.2606 - 1.2607 - <li>Author, <a href="#author" title=Author><strong>7.1.</strong></a> 1.2608 - 1.2609 - <li>authoring tool, <a href="#authoring-tool" 1.2610 - title="authoring tool"><strong>7.1.</strong></a> 1.2611 - 1.2612 - <li>backslash escapes, <a href="#character-escapes" 1.2613 - title="backslash escapes"><strong>4.1.</strong></a> 1.2614 - 1.2615 - <li>'bitmap' media group, <a href="#bitmap" 1.2616 - title="'bitmap' media group"><strong>8.7.</strong></a> 1.2617 - 1.2618 - <li>block, <a href="#block" title=block>4.7.</a> 1.2619 - 1.2620 - <li>Blocks, <a href="#blocks0" title=Blocks><strong>4.7.</strong></a> 1.2621 - 1.2622 - <li>byte order mark (BOM), <a href="#BOM" 1.2623 - title="byte order mark (BOM)">3.</a> 1.2624 - 1.2625 - <li>case sensitivity, <a href="#case-insensitive" 1.2626 - title="case sensitivity">4.1.</a> 1.2627 - 1.2628 - <li>character encoding, <a href="#encoded" 1.2629 - title="character encoding"><strong>3.</strong></a> 1.2630 - <ul> 1.2631 - <li>default, <a href="#character-encoding" 1.2632 - title="character encoding, default">3.</a> 1.2633 - 1.2634 - <li>user agent's determination of, <a href="#priorities" 1.2635 - title="character encoding, user agent's determination of">3.</a> 1.2636 - </ul> 1.2637 - 1.2638 - <li>@charset, <a href="#charset" title="@charset">3.</a>, <a 1.2639 - href="#charset0" title="@charset"><strong>3.</strong></a> 1.2640 - 1.2641 - <li>color, <a href="#color" title=color>9.1.</a> 1.2642 - 1.2643 - <li>COMMENT, <a href="#comment" title=COMMENT><strong>4.3.2.</strong></a> 1.2644 - 1.2645 - <li>Comments, <a href="#comments-" title=Comments>4.10.</a>, <a 1.2646 - href="#comments0" title=Comments><strong>4.10.</strong></a> 1.2647 - 1.2648 - <li>'continuous' media group, <a href="#continuous" 1.2649 - title="'continuous' media group"><strong>8.7.</strong></a> 1.2650 - 1.2651 - <li>declaration, <a href="#declaration" 1.2652 - title=declaration><strong>4.9.</strong></a> 1.2653 - 1.2654 - <li>declaration-block, <a href="#declaration-block" 1.2655 - title=declaration-block><strong>4.8.</strong></a> 1.2656 - 1.2657 - <li>default 1.2658 - <ul> 1.2659 - <li>character encoding, <a href="#character-encoding" 1.2660 - title="default, character encoding">3.</a> 1.2661 - </ul> 1.2662 - 1.2663 - <li>error handling points, <a href="#error-handling-points" 1.2664 - title="error handling points"><strong>4.3.1.</strong></a> 1.2665 - 1.2666 - <li>forward-compatible parsing, <a href="#forward-compatible-parsing" 1.2667 - title="forward-compatible parsing"><strong>4.</strong></a> 1.2668 - 1.2669 - <li>'grid' media group, <a href="#grid" 1.2670 - title="'grid' media group"><strong>8.7.</strong></a> 1.2671 - 1.2672 - <li>identifier, <a href="#identifiers" 1.2673 - title=identifier><strong>4.1.</strong></a> 1.2674 - 1.2675 - <li>ignore, <a href="#ignore" title=ignore>4.6.</a>, <a href="#ignore0" 1.2676 - title=ignore>4.8.</a>, <a href="#ignore1" title=ignore>4.8.</a>, <a 1.2677 - href="#ignore2" title=ignore>4.9.</a>, <a href="#ignore3" 1.2678 - title=ignore>4.9.</a>, <a href="#ignore4" 1.2679 - title=ignore><strong>5.</strong></a>, <a href="#ignore5" 1.2680 - title=ignore>5.</a>, <a href="#ignore6" title=ignore>5.</a>, <a 1.2681 - href="#ignore7" title=ignore>5.</a>, <a href="#ignore8" 1.2682 - title=Ignore><strong>7.1.</strong></a>, <a href="#ignored" 1.2683 - title=ignore>4.8.</a>, <a href="#ignored." title=ignore>5.</a>, <a 1.2684 - href="#ignores" title=ignore>4.6.</a>, <a href="#ignores0" 1.2685 - title=ignore>5.</a> 1.2686 - 1.2687 - <li>illegal, <a href="#illegal" title=illegal><strong>7.1.</strong></a> 1.2688 - 1.2689 - <li>'interactive' media group, <a href="#interactive" 1.2690 - title="'interactive' media group"><strong>8.7.</strong></a> 1.2691 - 1.2692 - <li>ISO-10646, <a href="#iso-10646" title=ISO-10646>9.2.</a> 1.2693 - 1.2694 - <li>LL(1), <a href="#ll1" title="LL(1)">9.1.</a> 1.2695 - 1.2696 - <li>"MAY", <a href="#may" title=""MAY""><strong>7.</strong></a> 1.2697 - 1.2698 - <li>message entity, <a href="#message-entity" 1.2699 - title="message entity"><strong>3.2.</strong></a> 1.2700 - 1.2701 - <li>"MUST", <a href="#must" 1.2702 - title=""MUST""><strong>7.</strong></a> 1.2703 - 1.2704 - <li>"MUST NOT", <a href="#must-not" 1.2705 - title=""MUST NOT""><strong>7.</strong></a> 1.2706 - 1.2707 - <li>"OPTIONAL", <a href="#optional" 1.2708 - title=""OPTIONAL""><strong>7.</strong></a> 1.2709 - 1.2710 - <li>'paged' media group, <a href="#paged" 1.2711 - title="'paged' media group"><strong>8.7.</strong></a> 1.2712 - 1.2713 - <li>property, <a href="#property" title=property><strong>4.9.</strong></a> 1.2714 - 1.2715 - 1.2716 - <li>'property-name', <a href="#property-name" 1.2717 - title="'property-name'"><strong>8.</strong></a> 1.2718 - 1.2719 - <li>"RECOMMENDED", <a href="#recommended" 1.2720 - title=""RECOMMENDED""><strong>7.</strong></a> 1.2721 - 1.2722 - <li>"REQUIRED", <a href="#required" 1.2723 - title=""REQUIRED""><strong>7.</strong></a> 1.2724 - 1.2725 - <li>rule sets, <a href="#rule-sets." title="rule sets">4.5.</a> 1.2726 - 1.2727 - <li>selector, <a href="#selector" 1.2728 - title=selector><strong>4.8.</strong></a>, <a href="#selector0" 1.2729 - title=selector>9.1.</a> 1.2730 - 1.2731 - <li>"SHALL", <a href="#shall" 1.2732 - title=""SHALL""><strong>7.</strong></a> 1.2733 - 1.2734 - <li>"SHALL NOT", <a href="#shall-not" 1.2735 - title=""SHALL NOT""><strong>7.</strong></a> 1.2736 - 1.2737 - <li>shorthand property, <a href="#shorthand-properties0" 1.2738 - title="shorthand property"><strong>8.8.</strong></a> 1.2739 - 1.2740 - <li>"SHOULD", <a href="#should" 1.2741 - title=""SHOULD""><strong>7.</strong></a> 1.2742 - 1.2743 - <li>"SHOULD NOT", <a href="#should-not" 1.2744 - title=""SHOULD NOT""><strong>7.</strong></a> 1.2745 - 1.2746 - <li>'speech' media group, <a href="#speech" 1.2747 - title="'speech' media group"><strong>8.7.</strong></a> 1.2748 - 1.2749 - <li>statements, <a href="#statements0" title=statements>4.5.</a> 1.2750 - 1.2751 - <li>'static' media group, <a href="#static" 1.2752 - title="'static' media group"><strong>8.7.</strong></a> 1.2753 - 1.2754 - <li>string, <a href="#string" title=string>4.7.</a> 1.2755 - 1.2756 - <li>Style sheet, <a href="#style-sheet" 1.2757 - title="Style sheet"><strong>7.1.</strong></a> 1.2758 - 1.2759 - <li>'tactile' media group, <a href="#tactile" 1.2760 - title="'tactile' media group"><strong>8.7.</strong></a> 1.2761 - 1.2762 - <li>text/css, <a href="#textcss" 1.2763 - title="text/css"><strong>3.2.</strong></a> 1.2764 - 1.2765 - <li>tokenizer, <a href="#tokenizer" 1.2766 - title=tokenizer><strong>9.2.</strong></a> 1.2767 - 1.2768 - <li>UA, <a href="#user-agent" title=UA><strong>7.1.</strong></a> 1.2769 - 1.2770 - <li>Unicode, <a href="#unicode" title=Unicode>9.2.</a> 1.2771 - 1.2772 - <li>User, <a href="#user" title=User><strong>7.1.</strong></a> 1.2773 - 1.2774 - <li>user agent, <a href="#user-agent" 1.2775 - title="user agent"><strong>7.1.</strong></a> 1.2776 - 1.2777 - <li>User agent (UA), <a href="#user-agent-ua" 1.2778 - title="User agent (UA)"><strong>7.1.</strong></a> 1.2779 - 1.2780 - <li>Valid style sheet, <a href="#valid-style-sheet" 1.2781 - title="Valid style sheet"><strong>7.1.</strong></a> 1.2782 - 1.2783 - <li>value, <a href="#values" title=value><strong>4.9.</strong></a> 1.2784 - 1.2785 - <li>'visual' media group, <a href="#visual" 1.2786 - title="'visual' media group"><strong>8.7.</strong></a> 1.2787 - 1.2788 - <li>whitespace, <a href="#whitespace" 1.2789 - title=whitespace><strong>4.3.2.</strong></a> 1.2790 - </ul> 1.2791 - <!--end-index--> 1.2792 - </body> 1.2793 - <!-- Keep this comment at the end of the file 1.2794 -Local variables: 1.2795 -mode: sgml 1.2796 -sgml-declaration:"~/SGML/HTML4.decl" 1.2797 -sgml-default-doctype-name:"html" 1.2798 -sgml-minimize-attributes:t 1.2799 -sgml-nofill-elements:("pre" "style" "br") 1.2800 -sgml-live-element-indicator:t 1.2801 -End: 1.2802 --->
2.1 --- a/css-syntax/oldsrc.html Mon Oct 28 15:36:16 2013 -0700 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,1830 +0,0 @@ 2.4 -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 2.5 - "http://www.w3.org/TR/html4/loose.dtd"> 2.6 -<!-- vim:expandtab:tabstop=2:shiftwidth=2:textwidth=72: 2.7 - --> 2.8 -<html> 2.9 -<!-- the command line to process is this is: 2.10 - 2.11 -num -l 2 template.html | toc -l 2 | incl | xref | index |\ 2.12 -perl -I../bin ../bin/propindex | cite-mkbib ../biblio.ref \ 2.13 ->template-processed.html 2.14 - 2.15 - 2.16 -To do: add longdesc 2.17 - 2.18 ---> 2.19 -<head> 2.20 - <title>CSS Syntax Module Level 3</title> 2.21 - <link rel="stylesheet" type="text/css" href="../default.css"> 2.22 - <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-MO"> 2.23 -</head> 2.24 - 2.25 -<body> 2.26 - 2.27 -<div class="head"> 2.28 -<p><a class="logo" rel="home" href="http://www.w3.org/"><img height="48" 2.29 -width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"></a><a 2.30 -class="logo" rel="in-activity" href="../"><img 2.31 -src="../../../Woolly/woolly-icon.png" height="48" width="72" 2.32 -alt=" CSS WG"></a></p> 2.33 - 2.34 -<h1>CSS Syntax Module Level 3</h1> 2.35 - 2.36 -<h2 class="no-num no-toc">W3C Working Draft [DATE: 13 August 2003]</h2> 2.37 -<dl> 2.38 - <dt>This version:</dt> 2.39 - <dd><a 2.40 - href="http://www.w3.org/TR/[YEAR]/WD-css3-syntax-[ISODATE]">http://www.w3.org/TR/[YEAR]/WD-css3-syntax-[ISODATE]</a></dd> 2.41 - <dt>Latest version:</dt> 2.42 - <dd><a 2.43 - href="http://www.w3.org/TR/css3-syntax">http://www.w3.org/TR/css3-syntax</a></dd> 2.44 - <dt>Previous version:</dt> 2.45 - <dd><a href="http://www.w3.org/TR/2003/WD-css3-syntax-20030813">http://www.w3.org/TR/2003/WD-css3-syntax-20030813</a></dd> 2.46 - <dt>Editor:</dt> 2.47 - <dd><a href="http://dbaron.org/">L. David Baron</a>, <<a href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a>></dd> 2.48 - <dt>Additional Contributors:</dt> 2.49 - <dd>Original CSS2 Authors</dd> 2.50 - <dd>Bert Bos (W3C), <<a href="mailto:bert@w3.org">bert@w3.org</a>></dd> 2.51 - <dd>Peter Linss (Netscape)</dd> 2.52 -</dl> 2.53 -<!--begin-copyright--> 2.54 - 2.55 -<p>[Here will be included the file "../copyright.inc"]</p> 2.56 -<!--end-copyright--> 2.57 -<hr title="Separator for header"> 2.58 -</div> 2.59 - 2.60 -<p style="background: #fdd; color: red; font-weight: bold; text-align: center; padding: .5em; border: thick solid red; border-radius: 1em; position: fixed; bottom: 1em; left: 1em; right: 1em;">This specification is not being actively maintained, and should not be used as a guide for implementations. It may be revived in the future, but for now should be considered obsolete. <br>If you have questions or comments on this specification, please send an email to the CSS Working Group's mailing list at <a href="mailto:www-style@w3.org">www-style@w3.org</a>. (Before sending mail for the first time, you have to subscribe at <a href="http://lists.w3.org/Archives/Public/www-style/">http://lists.w3.org/Archives/Public/www-style/</a>.)</p> 2.61 - 2.62 -<h2 class="no-num no-toc" id="abstract">Abstract</h2> 2.63 - 2.64 -<p>This CSS3 module describes the basic structure of CSS style sheets, 2.65 -some of the details of the syntax, and the rules for parsing CSS 2.66 -style sheets. It also describes (in some cases, informatively) how 2.67 -stylesheets can be linked to documents and how those links can be 2.68 -media-dependent. Additional details of the syntax of some parts of CSS 2.69 -described in other modules will be described in those modules. The 2.70 -selectors module has a grammar for selectors. Modules that define 2.71 -properties give the grammar for the values of those properties, in a 2.72 -format described in this document.</p> 2.73 - 2.74 -<h2 class="no-num no-toc" id="status">Status of this document</h2> 2.75 - 2.76 -<p><em>This section describes the status of this document at the 2.77 -time of its publication. Other documents may supersede this 2.78 -document. A list of current W3C publications and the latest revision 2.79 -of this technical report can be found in the <a 2.80 -href="http://www.w3.org/TR/">W3C technical reports index</a> at 2.81 -http://www.w3.org/TR/. The latest revision can also be found by 2.82 -following the "Latest Version" link above.</em></p> 2.83 - 2.84 -<p> 2.85 -This document is a draft of one of the modules of CSS Level 3 (CSS3). 2.86 -Some parts of the document are derived from the CSS Level 1 and CSS 2.87 -Level 2 recommendations, and those parts are thus relatively stable. 2.88 -However, it is otherwise an early draft, and considerable revision is 2.89 -expected in later drafts, especially in formalization of error handling 2.90 -behavior, the conformance requirements for partial implementations 2.91 -(given the modularization of CSS3), and integration with other CSS3 2.92 -modules. 2.93 -</p> 2.94 - 2.95 -<p>This document is a working draft of the CSS working group 2.96 -which is part of the <a href="http://www.w3.org/Style/">style 2.97 -activity</a> (see <a 2.98 -href="http://www.w3.org/Style/Activity">summary</a>). 2.99 -</p> 2.100 - 2.101 -<p>The working group would like to receive feedback: 2.102 - discussion takes place on the (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) 2.103 - public mailing list <a href="http://www.w3.org/Mail/Lists.html#www-style">www-style@w3.org</a> (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C Members 2.104 - can also send comments directly to the CSS working group. </p> 2.105 - 2.106 -<p>This is a draft document and may be updated, replaced or 2.107 -obsoleted by other documents at any time. It is inappropriate to cite 2.108 -this document as other than work in progress. 2.109 -Its publication does not imply endorsement by the W3C membership or the 2.110 -<a href="http://www.w3.org/Style/Group/">CSS & FP Working Group</a> 2.111 -(<a href="http://cgi.w3.org/MemberAccess/AccessRequest">members only</a>). 2.112 -</p> 2.113 - 2.114 -<p>Patent disclosures relevant to CSS may be found on the Working Group's 2.115 -public <a href="http://www.w3.org/Style/CSS/Disclosures" 2.116 -rel="disclosure">patent disclosure page.</a></p> 2.117 - 2.118 -<p>This document may be available in translations in the future. The English 2.119 -version of this specification is the only normative version.</p> 2.120 - 2.121 -<h2 class="no-num no-toc" id="contents">Table of contents</h2> 2.122 -<!--toc--> 2.123 -<hr> 2.124 - 2.125 - 2.126 -<h2>Dependencies on other modules</h2> 2.127 - 2.128 -<p>This CSS3 module 2.129 -depends on the following other CSS3 modules:</p> 2.130 -<ul> 2.131 - <li>Selectors [[!SELECT]]</li> 2.132 - <li>CSS3 module: Values & Units [[!CSS3VAL]]</li> 2.133 - <li>CSS3 module: Cascading & Inheritance [[!CSS3CASCADE]]</li> 2.134 -</ul> 2.135 - 2.136 -<p>It has non-normative (informative) references to the following other 2.137 -CSS3 modules:</p> 2.138 -<ul> 2.139 - <li>CSS3 module: Paged media [[CSS3PAGE]]</li> 2.140 - <li>CSS3 module: Speech [[CSS3SPEECH]]</li> 2.141 - <li>Media queries [[MEDIAQ]]</li> 2.142 - <li>Syntax of CSS rules in HTML's "style" attribute [[CSSSTYLEATTR]]</li> 2.143 -</ul> 2.144 - 2.145 -<h2>Introduction</h2> 2.146 - 2.147 -<p>This specification describes the basic syntax of CSS3 and the syntax 2.148 -conventions used in the property definitions spread through the CSS3 2.149 -modules. The syntax of CSS3 has some error-handling requirements for 2.150 -forward-compatibility, but much of the error-handling behavior depends 2.151 -on the user agent.</p> 2.152 - 2.153 -<h2>CSS style sheet representation</h2> 2.154 - 2.155 -<p>A CSS style sheet is a sequence of characters from the Universal 2.156 -Character Set (see [[!ISO10646]]). For transmission and storage, these 2.157 -characters must be <dfn title="character 2.158 -encoding">encoded</dfn> by a character encoding that supports the set 2.159 -of characters available in US-ASCII (e.g., ISO-8859-x, Shift_JIS, etc.). 2.160 -A <span id="BOM" class="index">byte order mark (BOM)</span>, as described in 2.161 -section 2.7 of [[!UNICODE310]], that begins the sequence of characters 2.162 -should not be considered, for purposes of applying the grammar below, as 2.163 -a part of the style sheet. For a good introduction to character sets and 2.164 -character encodings, please consult the HTML 4.0 specification 2.165 -([[!HTML40]], chapter 5). See also the XML 1.0 specification ([[XML10]], 2.166 -sections 2.2 and 4.3.3).</p> 2.167 - 2.168 -<p>When a style sheet is embedded in another document, such as in the 2.169 -STYLE element or "style" attribute of HTML, the style sheet shares the 2.170 -character encoding of the whole document.</p> 2.171 - 2.172 -<p>When a style sheet resides in a separate file, user agents must 2.173 -observe the following <span class="index" title="character 2.174 -encoding::user agent's determination of">priorities</span> when 2.175 -determining a style sheet's <span class="index" title="character 2.176 -encoding::default|default::character encoding">character 2.177 -encoding</span> (from highest priority to lowest):</p> 2.178 - 2.179 -<ol> 2.180 -<li>A character encoding specified by a higher level protocol (e.g., the 2.181 -"charset" parameter to the MIME type specified in an HTTP "Content-Type" 2.182 -field). 2.183 -(The HTTP protocol ([[!HTTP11]], section 3.7.1) mentions ISO-8859-1 as a 2.184 -default character encoding when the "charset" parameter is absent from 2.185 -the "Content-Type" header field. In practice, this recommendation has 2.186 -proved useless because some servers don't allow a "charset" parameter to 2.187 -be sent, and others may not be configured to send the parameter. 2.188 -Therefore, user agents must not assume any default value for the 2.189 -"charset" parameter, but must instead look for the <span 2.190 -class="index">@charset</span> rule.) 2.191 -</li> 2.192 -<li>The <dfn>@charset</dfn> 2.193 -at-rule.</li> 2.194 -<li>Assume that the style sheet is UTF-8.</li> 2.195 -</ol> 2.196 - 2.197 -<p>Since the third point differs from CSS1 and CSS2, authors should not 2.198 -rely on user agents to assume that style sheets without encoding 2.199 -information are UTF-8 encoded. Authors should specify the encoding 2.200 -using one of the first two methods.</p> 2.201 - 2.202 -<p>At most one @charset rule may appear in an external 2.203 -style sheet — it must <em>not</em> appear in an embedded style sheet 2.204 -— and it must appear at the very start of the style sheet, not preceded 2.205 -by any characters (except for the optional Byte Order Mark <a 2.206 -href="#BOM">described 2.207 -above)</a>. After "@charset", authors specify the name of a 2.208 -character encoding. The name must be a charset name as described in 2.209 -the IANA registry (See [[!RFC2978]]. Also, see [[CHARSETS]] for a complete 2.210 -list of charsets). For example:</p> 2.211 - 2.212 -<div class="example"><p> 2.213 -@charset "ISO-8859-1"; 2.214 -</div> 2.215 - 2.216 -<p>This specification does not mandate which character encodings 2.217 -a user agent must support. 2.218 -<span class="issue">[Should we require a certain minimal set, such as 2.219 -UTF-8 and UCS2?]</span> 2.220 -</p> 2.221 - 2.222 -<p>Note that reliance on the @charset construct theoretically poses a 2.223 -problem since there is no <em>a priori</em> information on how it is 2.224 -encoded. In practice, however, the encodings in wide use on the 2.225 -Internet are either based on ASCII, UTF-16, UCS-4, or (rarely) on 2.226 -EBCDIC. This means that in general, the initial byte values of a 2.227 -style sheet enable a user agent to detect the encoding family reliably, 2.228 -which provides enough information to decode the @charset rule, which 2.229 -in turn determines the exact character encoding.</p> 2.230 - 2.231 -<div class="issue">[Should this specification describe how to handle 2.232 -encoding errors? Can a user agent ignore the <code>@charset</code> rule 2.233 -if it's wrong? What if the user agent does not support the encoding 2.234 -used? Should this specification describe how to handle a 2.235 -<code>@charset</code> rule that specifies a character encoding that is 2.236 -incompatible with the family of encodings used to decode the 2.237 -<code>@charset</code> rule (and BOM) itself?]</div> 2.238 - 2.239 -<!-- More examples of good encodings to use? -IJ --> 2.240 - 2.241 -<!-- Encodings not to use? (cf. HTML 4.0) -IJ --> 2.242 - 2.243 -<h3>Referring to characters not represented in a character encoding</h3> 2.244 - 2.245 -<p>A style sheet may have to refer to characters that cannot be 2.246 -represented in the current character encoding. These characters must 2.247 -be written as <span title="backslash escapes">escaped</span> references to 2.248 -ISO 10646 characters. These escapes serve the same purpose as numeric 2.249 -character references in HTML or XML documents (see [[!HTML40]], 2.250 -chapters 5 and 25). 2.251 - 2.252 -<p>The character escape mechanism should be used when only a few 2.253 -characters must be represented this way. If most of a style sheet 2.254 -requires escaping, authors should encode it with a more appropriate 2.255 -encoding (e.g., if the style sheet contains a lot of Greek characters, 2.256 -authors might use "ISO-8859-7" or "UTF-8"). 2.257 - 2.258 -<p>Intermediate processors using a different character encoding may 2.259 -translate these escaped sequences into byte sequences of that 2.260 -encoding. Intermediate processors must not, on 2.261 -the other hand, alter escape sequences that cancel the special meaning 2.262 -of an ASCII character. 2.263 - 2.264 -<p><a href="#conformance">Conforming user agents</a> must 2.265 -correctly map to Unicode all characters in any character encodings 2.266 -that they recognize (or they must behave as if they did). 2.267 - 2.268 -<p>For example, a style sheet transmitted as ISO-8859-1 2.269 -(Latin-1) cannot contain Greek letters directly: 2.270 -"κουρος" (Greek: "kouros") has to be 2.271 -written as "\3BA\3BF\3C5\3C1\3BF\3C2". 2.272 - 2.273 -<div class="note"><p> 2.274 -<em><strong>Note.</strong> 2.275 -In HTML 4.0, 2.276 -numeric character references are interpreted in "style" attribute 2.277 -values but not in the content of the STYLE element. Because of this 2.278 -asymmetry, we recommend that authors use the CSS character 2.279 -escape mechanism rather than numeric character references 2.280 -for both the "style" attribute and the STYLE element. 2.281 -For example, we recommend:</em></p> 2.282 - 2.283 -<pre class="html-example"> 2.284 -<span style="voice-family: D\FC rst">...</span> 2.285 -</pre> 2.286 - 2.287 -<p><em>rather than:</em></p> 2.288 - 2.289 -<pre class="html-example"> 2.290 -<span style="voice-family: D&#252;rst">...</span> 2.291 -</pre> 2.292 -</div> 2.293 - 2.294 -<h3>The <dfn>text/css</dfn> content type</h3> 2.295 - 2.296 -<p>CSS style sheets that exist in separate files are sent over the 2.297 -Internet as a sequence of bytes accompanied by encoding 2.298 -information<!--(see [[!HTML40]], chapter 5)-->. The structure of the 2.299 -transmission, termed a <dfn title="message entity">message 2.300 -entity,</dfn> is defined by MIME and HTTP 1.1 (see 2.301 -[[!RFC2045]] and [[!HTTP11]]). A message entity with a content type of 2.302 -"text/css" represents an independent CSS style sheet. The "text/css" 2.303 -content type has been registered by RFC 2318 ([[!RFC2318]]).</p> 2.304 - 2.305 -<h2 id="syntax">General syntax of CSS</h2> 2.306 - 2.307 -<p>This section describes a grammar (and <dfn>forward-compatible 2.308 -parsing</dfn> rules) common to any version of CSS (including 2.309 -CSS3). Future versions of CSS will adhere to this core syntax, although 2.310 -they may add additional syntactic constraints.</p> 2.311 - 2.312 -<p>See the <a href="#characters">section on characters and case</a> for 2.313 -information on case-sensitivity.</p> 2.314 - 2.315 -<p>These descriptions are normative. 2.316 - 2.317 -<h3 id="characters">Characters and case</h3> 2.318 -<p> The following rules always hold:</p> 2.319 - 2.320 -<UL> 2.321 - <li><p>All CSS style sheets are <span class="index" title="case 2.322 - sensitivity">case-insensitive</span>, except for parts that are 2.323 - not under the control of CSS. For example, the case-sensitivity of 2.324 - values of the HTML attributes "id" and "class", of font names, and 2.325 - of URIs lies outside the scope of this specification. Note in 2.326 - particular that element names are case-insensitive in HTML, but 2.327 - case-sensitive in XML.</p></li> 2.328 - 2.329 - <li><p>In CSS3, <dfn title="identifier">identifiers</dfn> 2.330 - (including element names, classes, and IDs in 2.331 - selectors (see [[!SELECT]] <span class="issue">[or is this still 2.332 - true]</span>)) can contain only the 2.333 - characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, 2.334 - plus the hyphen (-) and the underscore (_); they cannot start with a 2.335 - digit or a hyphen followed by a digit. They can also contain escaped 2.336 - characters and any ISO 10646 2.337 - character as a numeric code (see next item). 2.338 - <span class="example">For instance, the identifier 2.339 - "<code>B&W?</code>" may 2.340 - be written as "<code>B\&W\?</code>" or "<code>B\26 2.341 - W\3F</code>".</span> 2.342 - (See [[!UNICODE310]] and [[!ISO10646]].)</p></li> 2.343 - 2.344 - <li><p>In CSS3, a backslash (\) character indicates three types of 2.345 - <dfn title="backslash escapes">character escapes</dfn>.</p> 2.346 - 2.347 - <p>First, inside a string (see [[!CSS3VAL]]), a backslash 2.348 - followed by a newline is ignored (i.e., the string is deemed not 2.349 - to contain either the backslash or the newline).</p> 2.350 - 2.351 - <p>Second, it cancels the meaning of special CSS characters. 2.352 - Any character (except a hexadecimal digit) can be escaped 2.353 - with a backslash to remove its special meaning. 2.354 - For example, <samp>"\""</samp> is a string consisting of one 2.355 - double quote. Style sheet preprocessors must not remove 2.356 - these backslashes from a style sheet since that would 2.357 - change the style sheet's meaning.</p> 2.358 - 2.359 - <p>Third, backslash escapes allow authors to refer to characters 2.360 - they can't easily put in a style sheet. In this case, the backslash 2.361 - is followed by at most six hexadecimal digits (0..9A..F), which 2.362 - stand for the ISO 10646 ([[!ISO10646]]) character with 2.363 - that number. If a digit or letter follows the hexadecimal number, 2.364 - the end of the number needs to be made clear. There are two ways 2.365 - to do that:</p> 2.366 - 2.367 - <ol> 2.368 - <li>with a space (or other whitespace character): "\26 B" ("&B"). 2.369 - In this case, user agents should treat a "CR/LF" pair 2.370 - (13/10) as a single 2.371 - whitespace character.</li> 2.372 - <li>by providing exactly 6 hexadecimal digits: "\000026B" ("&B")</li> 2.373 - </ol> 2.374 - 2.375 - <p>In fact, these two methods may be combined. Only one whitespace 2.376 - character is ignored after a hexadecimal escape. Note that this means 2.377 - that a "real" space after the escape sequence must itself either be 2.378 - escaped or doubled.</p> 2.379 - </li> 2.380 - 2.381 - <li><p>Backslash escapes are always considered to be part of an 2.382 - <span>identifier</span> or a string (i.e., 2.383 - "\7B" is not punctuation, even though "{" is, and "\32" is allowed 2.384 - at the start of a class name, even though "2" is not).</p></li> 2.385 - </ul> 2.386 - 2.387 -<h3 id="tokenization">Tokenization</h3> 2.388 - 2.389 -<p class="issue">[This needs to be integrated with the selectors module. 2.390 -How should that be done?]</p> 2.391 - 2.392 -<p>All levels of CSS — level 1, level 2, level 3, and any future levels 2.393 -— use the same core syntax. This allows UAs to parse (though not 2.394 -completely understand) style sheets written in levels of CSS that didn't 2.395 -exist at the time the UAs were created. Designers can use this feature 2.396 -to create style sheets that work with older user agents, while also 2.397 -exercising the possibilities of the latest levels of CSS.</p> 2.398 - 2.399 -<p>At the lexical level, CSS style sheets consist of a sequence of 2.400 -tokens. Hexadecimal codes (e.g., <code>#x20</code>) refer to ISO 10646 2.401 -([[!ISO10646]]). In case of multiple matches, the longest match 2.402 -determines the token.</p> 2.403 - 2.404 -<p>The following productions are <em>parts</em> of tokens:</p> 2.405 - 2.406 -<p class="issue">[We need something to allow signs on integers. Do we need to 2.407 -go as far as css3-selectors?]</p> 2.408 - 2.409 -<table> 2.410 -<tr><td id="SUBTOK-ident">ident <td>::=<td><code>'-'? <a href="#SUBTOK-nmstart">nmstart</a> <a href="#SUBTOK-nmchar">nmchar</a>*</code> 2.411 -<tr><td id="SUBTOK-name">name <td>::=<td><code><a href="#SUBTOK-nmchar">nmchar</a>+</code> 2.412 -<tr><td id="SUBTOK-nmstart">nmstart <td>::=<td><code>[a-zA-Z] | '_' | <a href="#SUBTOK-nonascii">nonascii</a> | <a href="#SUBTOK-escape">escape</a></code> 2.413 -<tr><td id="SUBTOK-nonascii">nonascii <td>::=<td><code>[#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]</code> 2.414 -<tr><td id="SUBTOK-unicode">unicode <td>::=<td><code>'\' [0-9a-fA-F]{1,6} <a href="#SUBTOK-wc">wc</a>?</code> 2.415 -<tr><td id="SUBTOK-escape">escape <td>::=<td><code><a href="#SUBTOK-unicode">unicode</a> | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]</code> 2.416 -<tr><td id="SUBTOK-nmchar">nmchar <td>::=<td><code>[a-zA-Z0-9] | '-' | '_' | <a href="#SUBTOK-nonascii">nonascii</a> | <a href="#SUBTOK-escape">escape</a></code> 2.417 -<tr><td id="SUBTOK-num">num <td>::=<td><code>[0-9]+ | [0-9]* '.' [0-9]+</code> 2.418 -<tr><td id="SUBTOK-string">string <td>::=<td><code>'"' (<a href="#SUBTOK-stringchar">stringchar</a> | "'")* '"' | "'" (<a href="#SUBTOK-stringchar">stringchar</a> | '"')* "'"</code> 2.419 -<tr><td id="SUBTOK-stringchar">stringchar <td>::=<td><code><a href="#SUBTOK-urlchar">urlchar</a> | #x20 | '\' <a href="#SUBTOK-nl">nl</a></code> 2.420 -<tr><td id="SUBTOK-urlchar">urlchar <td>::=<td><code>[#x9#x21#x23-#x26#x27-#x7E] | <a href="#SUBTOK-nonascii">nonascii</a> | <a href="#SUBTOK-escape">escape</a></code> 2.421 -<tr><td id="SUBTOK-nl">nl <td>::=<td><code>#xA | #xD #xA | #xD | #xC</code> 2.422 -<tr><td id="SUBTOK-w">w <td>::=<td><code><a href="#SUBTOK-wc">wc</a>*</code> 2.423 -<tr><td id="SUBTOK-wc">wc <td>::=<td><code>#x9 | #xA | #xC | #xD | #x20</code> 2.424 -</table> 2.425 - 2.426 - 2.427 -<p>The following productions are the complete list of tokens in 2.428 -CSS3:</p> 2.429 - 2.430 -<table> 2.431 -<tr><td id="TOK-IDENT">IDENT <td>::=<td><code><a href="#SUBTOK-ident">ident</a></code> 2.432 -<tr><td id="TOK-ATKEYWORD">ATKEYWORD <td>::=<td><code>'@' <a href="#SUBTOK-ident">ident</a></code> 2.433 -<tr><td id="TOK-STRING">STRING <td>::=<td><code><a href="#SUBTOK-string">string</a></code> 2.434 -<tr><td id="TOK-HASH">HASH <td>::=<td><code>'#' <a href="#SUBTOK-name">name</a></code> 2.435 -<tr><td id="TOK-NUMBER">NUMBER <td>::=<td><code><a href="#SUBTOK-num">num</a></code> 2.436 -<tr><td id="TOK-PERCENTAGE">PERCENTAGE <td>::=<td><code><a href="#SUBTOK-num">num</a> '%'</code> 2.437 -<tr><td id="TOK-DIMENSION">DIMENSION <td>::=<td><code><a href="#SUBTOK-num">num</a> <a href="#SUBTOK-ident">ident</a></code> 2.438 -<tr><td id="TOK-URI">URI <td>::=<td><code>"url(" <a href="#SUBTOK-w">w</a> (<a href="#SUBTOK-string">string</a> | <a href="#SUBTOK-urlchar">urlchar</a>* ) <a href="#SUBTOK-w">w</a> ")"</code> 2.439 -<tr><td id="TOK-UNICODE-RANGE">UNICODE-RANGE <td>::=<td><code>"U+" [0-9A-F?]{1,6} ('-' [0-9A-F]{1,6})?</code> 2.440 -<tr><td id="TOK-CDO">CDO <td>::=<td><code>"<!--"</code> 2.441 -<tr><td id="TOK-CDC">CDC <td>::=<td><code>"-->"</code> 2.442 -<tr><td id="TOK-S">S <td>::=<td><code><a href="#SUBTOK-wc">wc</a>+</code> 2.443 -<tr><td id="TOK-COMMENT">COMMENT <td>::=<td><code>"/*" [^*]* '*'+ ([^/] [^*]* '*'+)* "/"</code> 2.444 -<tr><td id="TOK-FUNCTION">FUNCTION <td>::=<td><code><a href="#SUBTOK-ident">ident</a> '('</code> 2.445 -<tr><td id="TOK-INCLUDES">INCLUDES <td>::=<td><code>"~="</code> 2.446 -<tr><td id="TOK-DASHMATCH">DASHMATCH <td>::=<td><code>"|="</code> 2.447 -<tr><td id="TOK-PREFIXMATCH">PREFIXMATCH <td>::=<td><code>"^="</code> 2.448 -<tr><td id="TOK-SUFFIXMATCH">SUFFIXMATCH <td>::=<td><code>"$="</code> 2.449 -<tr><td id="TOK-SUBSTRINGMATCH">SUBSTRINGMATCH <td>::=<td><code>"*="</code> 2.450 -<tr><td id="TOK-CHAR">CHAR <td>::=<td>any other character not matched by the above rules, except for <code>"</code> or <code>'</code> 2.451 -<tr><td id="TOK-BOM">BOM <td>::=<td><code>#xFEFF</code> 2.452 -</table> 2.453 - 2.454 -<p> 2.455 - 2.456 - Since any single character other than ' or " that cannot be part of a 2.457 - larger token is a single character token, there cannot be errors in 2.458 - tokenization other than the inability to tokenize an unmatched 2.459 - quotation mark. If at some point it is not possible to continue 2.460 - tokenizing an incoming style sheet, the remainder of the style sheet 2.461 - should be ignored and only the largest initial segment of the 2.462 - style sheet that can be tokenized according to the above rules (that 2.463 - is, the entire style sheet except for the part from the unmatched 2.464 - (single or double) quotation mark to the end) should be used to form 2.465 - the sequence of tokens to be parsed according to the grammar. 2.466 - 2.467 -</p> 2.468 - 2.469 -<p class="issue">[This isn't exactly right. Since the string token can't 2.470 -contain newlines that aren't escaped by backslashes, an untokenizable 2.471 -sequence can occur in the middle of a file. Would it be better to 2.472 -change things so that unmatched quotation marks become single-character 2.473 -tokens and all character streams are tokenizable?]</p> 2.474 - 2.475 -<h3>Grammar</h3> 2.476 - 2.477 -<h4>Principles of CSS error handling</h4> 2.478 - 2.479 -<p>All levels of CSS, starting from CSS1, have required that user agents 2.480 -ignore certain types of invalid style sheets in well-defined ways. This 2.481 -allows forward-compatibility, since it allows future extensions to CSS 2.482 -within basic grammatical constraints that will be ignored in 2.483 -well-defined ways by user agents implementing earlier versions of 2.484 -CSS.</p> 2.485 - 2.486 -<p>Handling of CSS that is not valid CSS3 but is valid according to the 2.487 -forward-compatible syntax requires first determining the beginning and 2.488 -end of the part that is invalid and then handling that part in a 2.489 -specified way. The latter is described in the <a 2.490 -href="#error-handling">rules for handling parsing errors</a>. The 2.491 -mechanism for the former is described within the grammar.</p> 2.492 - 2.493 -<p>The handling of style sheets that do not parse according to the 2.494 -forward-compatible core syntax is not defined by this specification. 2.495 -<span class="issue">[Should it be?]</span> 2.496 -</p> 2.497 - 2.498 -<p>Certain productions within the grammar are <dfn>error handling 2.499 -points</dfn>. Every error handling point has a backup production that 2.500 -is to be used if it is not possible to parse the stream of tokens based 2.501 -on the primary production. If the error handling production is 2.502 -represented as <code>prod</code>, then the backup production is 2.503 -represented as <code>FAIL(prod)</code>.</p> 2.504 - 2.505 -<p class="issue">[The <a href="#detailed-grammar">grammar</a> given in 2.506 -Appendix D 2.507 -of CSS2 still needs to be incorporated into this specification. The editor 2.508 -hopes that it can be done by unifying it with the forward-compatible grammar 2.509 -into a single grammar that describes both the rules for forward-compatible 2.510 -parsing and the syntax of what is currently possible in CSS, but that may not 2.511 -be possible. However, hopefully it will be possible to do this by 2.512 -describing the general grammar in terms of the concepts described in the 2.513 -previous paragraph.]</p> 2.514 - 2.515 -<p>Excluding the transformation of a production into its backup 2.516 -production, this grammar is LL(1). <span class="issue">[We should 2.517 -explain briefly what this means, except that it's probably not true. 2.518 -It's probably just LALR(1).]</span> 2.519 -</p> 2.520 - 2.521 -<p>The portion of a CSS style sheet that is to be used is the largest 2.522 -initial stream of the tokens resulting from the <a 2.523 -href="#tokenization">tokenization process</a> that can be parsed 2.524 -according to the grammar presented in this chapter. (For example, if a 2.525 -brace closing a declaration block <span class="issue">[link-ify 2.526 -this]</span> is not present, the declaration block 2.527 -must be ignored since the closing brace is required to satisfy this 2.528 -grammar.) <span class="issue">[This might lead to highly unexpected 2.529 -behavior when there's an extra closing brace (etc.). Do we really want 2.530 -this?]</span></p> 2.531 - 2.532 -<p>Some of the constraints of CSS are not expressed in the grammar. For 2.533 -example, an <code>@charset</code> rule is not permitted in an embedded 2.534 -style sheet, or a namespace prefix that has not been defined by an 2.535 -<code>@namespace</code> rule is an invalid selector. These constraints 2.536 -should be handled just as a parsing error would be (by ignoring out to 2.537 -the next backup production) unless specified otherwise.</p> 2.538 - 2.539 -<h4>Style sheets</h4> 2.540 - 2.541 -<p>Below is the core syntax for CSS. Lowercase identifiers represent 2.542 -productions in this grammar, uppercase identifiers represent tokens (see 2.543 -above), and characters in single quotes (') represent CHAR tokens (see 2.544 -above). The sections that follow describe 2.545 -how to use it.</p> 2.546 - 2.547 -<p class="issue">[This might need better integration with the selectors 2.548 -module, although maybe it's ok.]</p> 2.549 - 2.550 -<PRE> 2.551 -stylesheet : [ CDO | CDC | S | statement ]*; 2.552 -statement : ruleset | at-rule; 2.553 -at-rule : ATKEYWORD S* any* [ block | ';' S* ]; 2.554 -block : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*; 2.555 -ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*; 2.556 -selector : any+; 2.557 -declaration : property ':' S* value; 2.558 -property : IDENT S*; 2.559 -value : [ any | block | ATKEYWORD S* ]+; 2.560 -any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING 2.561 - | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES 2.562 - | FUNCTION S* any* ')' | DASHMATCH | '(' S* any* ')' 2.563 - | '[' S* any* ']' ] S*; 2.564 -</PRE> 2.565 - 2.566 -<div class="issue"> 2.567 -[The definitions of these productions should be spread below into the 2.568 -prose describing what they mean. Furthermore, they should be combined 2.569 -with the Appendix D grammar from CSS2, perhaps using notation like: 2.570 -<table> 2.571 -<tr><td>ruleset</td><td>::=</td><td>...</td></tr> 2.572 -<tr><td>FAIL(ruleset)</td><td>::=</td><td>...</td></tr> 2.573 -</table> 2.574 -]</div> 2.575 - 2.576 -<p><dfn>COMMENT</dfn> tokens do not occur 2.577 -in the grammar (to keep it readable), but any number of these tokens 2.578 -may appear anywhere between other tokens. 2.579 - 2.580 -<p>The token S in the grammar above stands for <dfn>whitespace</dfn>. 2.581 -Only the characters "space" (Unicode 2.582 -code 32), "tab" (9), "line feed" (10), "carriage return" (13), and 2.583 -"form feed" (12) can occur in whitespace. Other space-like characters, 2.584 -such as "em-space" (8195) and "ideographic space" (12288), are never 2.585 -part of whitespace. 2.586 - 2.587 -<h3 id="keywords">Keywords</h3> 2.588 - 2.589 -<!-- provide better explanation of where keywords appear: 2.590 -media types, at-rules, etc. -IJ --> 2.591 - 2.592 -<p>Keywords have the form of identifiers. Keywords must not be placed 2.593 -between quotes ("..." or '...'). Thus, 2.594 - 2.595 -<pre> 2.596 -red 2.597 -</pre> 2.598 - 2.599 -<p>is a keyword, but 2.600 - 2.601 -<pre> 2.602 -"red" 2.603 -</pre> 2.604 - 2.605 -<p>is not. (It is a string.) Other illegal examples: 2.606 - 2.607 -<div class="illegal example"><p> 2.608 -<pre> 2.609 -width: "auto"; 2.610 -border: "none"; 2.611 -background: "red"; 2.612 -</pre> 2.613 -</div> 2.614 - 2.615 - 2.616 -<h3>Statements</h3> 2.617 - 2.618 -<p>A CSS style sheet, for any version of CSS, consists of a list of 2.619 -<em class="index">statements</em> 2.620 -(see the grammar above). There are two kinds of statements: <em 2.621 -class="index">at-rules</em> 2.622 -and <em class="index" title="rule sets">rule 2.623 -sets.</em> There may be <a href="#whitespace">whitespace</a> 2.624 -around the statements.</p> 2.625 - 2.626 -<h3><dfn>At-rules</dfn></h3> 2.627 - 2.628 -<p> At-rules start with an <DFN>at-keyword</DFN>, an '@' character 2.629 -followed immediately by an <span>identifier</span> (for example, '@import', 2.630 -'@page'). 2.631 - 2.632 -<p> An at-rule consists of everything up to and including the next 2.633 -semicolon (;) or the next <a href="#block">block,</a> whichever comes 2.634 -first. A CSS user agent that encounters an unrecognized or misplaced 2.635 -at-rule must <span class="index">ignore</span> the whole of the at-rule and continue 2.636 -parsing after it.</p> 2.637 - 2.638 -<div class="illegal example"><p> 2.639 -Assume, for example, that a CSS3 parser encounters this style sheet: 2.640 - 2.641 -<PRE> 2.642 -@import "subs.css"; 2.643 -h1 { color: blue } 2.644 -@import "list.css"; 2.645 -</PRE> 2.646 - 2.647 -<p>The second '<code>@import</code>' is illegal according to CSS3 since 2.648 -'<code>@import</code>' rules must occur before all rules other than 2.649 -'<code>@charset</code>' rules. The CSS3 parser 2.650 -<span class="index" title="ignore">ignores</span> 2.651 -the whole at-rule, effectively reducing the style sheet to: 2.652 - 2.653 -<PRE> 2.654 -@import "subs.css"; 2.655 -h1 { color: blue } 2.656 -</PRE> 2.657 -</div> 2.658 - 2.659 -<div class="illegal example"><p> 2.660 -In the following example, the second '@import' rule is invalid, 2.661 -since it occurs inside a '@media' <a href="#block">block</a>. 2.662 - 2.663 -<PRE> 2.664 -@import "subs.css"; 2.665 -@media print { 2.666 - @import "print-main.css"; 2.667 - BODY { font-size: 10pt } 2.668 -} 2.669 -h1 {color: blue } 2.670 -</PRE> 2.671 -</div> 2.672 - 2.673 -<h3><dfn>Blocks</dfn></h3> 2.674 - 2.675 -<p> A <span class="index"><em>block</em></span> 2.676 -starts with a left curly brace ({) and ends with the matching right 2.677 -curly brace (}). In between there may be any characters, except that 2.678 -parentheses (( )), brackets ([ ]) and braces ({ }) must 2.679 -always occur in 2.680 -matching pairs and may be nested. Single (') and double quotes (") 2.681 -<!-- " --> must also occur in matching pairs, and characters between them 2.682 -are parsed as a <span class="index">string</span>. 2.683 -See <a href="#tokenization">Tokenization</a> above for the definition 2.684 -of a string. 2.685 - 2.686 - 2.687 -<div class="illegal example"> 2.688 -<p> Here is an example of a block. Note that the right brace between 2.689 -the double quotes does not match the opening brace of the block, and that the 2.690 -second single quote is an <span title="backslash escapes">escaped 2.691 -character</span>, and thus doesn't match the first single quote: 2.692 - 2.693 -<PRE> 2.694 -{ causta: "}" + ({7} * '\'') } 2.695 -</PRE> 2.696 - 2.697 -<p>Note that the above rule is not valid CSS3, but it is still 2.698 -a block as defined above. 2.699 -</div> 2.700 - 2.701 -<h3>Rule sets, declaration blocks, and selectors</h3> 2.702 - 2.703 -<p> A rule set (also called "rule") consists of a selector followed by 2.704 -a declaration block. 2.705 - 2.706 -<p> A <dfn>declaration-block</dfn> (also 2.707 -called a {}-block in the following text) starts with a left curly 2.708 -brace ({) and ends with the matching right curly brace (}). In between 2.709 -there must be a list of zero or more semicolon-separated (;) 2.710 -declarations. 2.711 - 2.712 -<p>The <dfn>selector</dfn> (see the Selectors module 2.713 -[[!SELECT]]) consists of everything up to (but 2.714 -not including) the first left curly brace ({). A selector always goes 2.715 -together with a {}-block. When a user agent can't parse the selector (i.e., it 2.716 -is not valid CSS3), it must <span class="index">ignore</span> the {}-block as well. 2.717 - 2.718 -<p>CSS3 gives a special meaning to the comma (,) in 2.719 -selectors. However, since it is not known if the comma may acquire 2.720 -other meanings in future versions of CSS, the whole statement should 2.721 -be <span class="index" title="ignore">ignored</span> if there is an error anywhere in the 2.722 -selector, even though the rest of the selector may look reasonable in 2.723 -CSS3. 2.724 - 2.725 -<DIV class=illegal example> 2.726 -<p>For example, since the "&" is not a valid token in a CSS3 2.727 -selector, a CSS3 user agent must 2.728 -<span class="index">ignore</span> 2.729 -the whole second line, and not set the color of H3 to red: 2.730 -<PRE> 2.731 -h1, h2 {color: green } 2.732 -h3, h4 & h5 {color: red } 2.733 -h6 {color: black } 2.734 -</PRE> 2.735 -</DIV> 2.736 - 2.737 -<div class="example"><p> 2.738 -<p>Here is a more complex example. The first two pairs of curly braces 2.739 -are inside a string, and do not mark the end of the selector. This is 2.740 -a valid CSS3 statement. 2.741 -<PRE> 2.742 -p[example="public class foo\ 2.743 -{\ 2.744 - private int x;\ 2.745 -\ 2.746 - foo(int x) {\ 2.747 - this.x = x;\ 2.748 - }\ 2.749 -\ 2.750 -}"] { color: red } 2.751 -</PRE> 2.752 - 2.753 -<div class="note"><p> 2.754 -<em><strong>Note.</strong> 2.755 -The <span class="css">\</span> characters in the above example cause the 2.756 -newlines to be ignored. Newlines can be placed in strings only using the 2.757 -correct numeric character escape. See <a href="#characters">characters 2.758 -and case</a> above. 2.759 -</em></p></div> 2.760 -</div> 2.761 - 2.762 -<h3 id="declarations">Declarations and properties</h3> 2.763 - 2.764 -<p> A <dfn>declaration</dfn> is either empty or 2.765 -consists of a <dfn>property</dfn>, followed by a colon (:), followed by 2.766 -a value. Around each of these there may be <a 2.767 -href="#whitespace">whitespace</a>. 2.768 - 2.769 -<p>Because of the way selectors work, multiple declarations for the 2.770 -same selector may be organized into semicolon (;) separated 2.771 -groups.</p> 2.772 - 2.773 -<div class="example"><p> 2.774 -Thus, the following rules:</p> 2.775 -<pre> 2.776 -h1 { font-weight: bold } 2.777 -h1 { font-size: 2em } 2.778 -h1 { line-height: 1.2 } 2.779 -h1 { font-family: Helvetica, Arial, sans-serif } 2.780 -h1 { font-variant: normal } 2.781 -h1 { font-style: normal } 2.782 -</pre> 2.783 - 2.784 -<p>are equivalent to:</p> 2.785 - 2.786 -<pre> 2.787 -h1 { 2.788 - font-weight: bold; 2.789 - font-size: 2em; 2.790 - line-height: 1.2; 2.791 - font-family: Helvetica, Arial, sans-serif; 2.792 - font-variant: normal; 2.793 - font-style: normal 2.794 -} 2.795 -</pre> 2.796 -</div> 2.797 - 2.798 -<p>A property is an <span>identifier</span>. Any character may occur 2.799 -in the value, but parentheses ("( )"), brackets ("[ ]"), 2.800 -braces ("{ }"), single 2.801 -quotes (') and double quotes (") <!-- " --> must come in matching 2.802 -pairs, and semicolons not in strings must be <span title="backslash 2.803 -escapes">escaped</span>. Parentheses, brackets, and 2.804 -braces may be nested. Inside the quotes, characters are parsed as a 2.805 -string. 2.806 - 2.807 -<p>The syntax of <dfn title="value">values</dfn> 2.808 -is specified separately for each property, but in any case, values are 2.809 -built from identifiers, strings, numbers, lengths, percentages, URIs, 2.810 -colors, angles, times, and frequencies. 2.811 - 2.812 -<p>A user agent must <span class="index">ignore</span> a declaration with an invalid property 2.813 -name or an invalid value. Every CSS3 property has its own syntactic 2.814 -and semantic restrictions on the values it accepts. 2.815 - 2.816 -<div class="illegal example"><p> 2.817 -For example, assume a CSS3 parser encounters this style sheet: 2.818 - 2.819 -<PRE> 2.820 -h1 { color: red; font-style: 12px } /* Invalid value: 12px */ 2.821 -p { color: blue; font-vendor: any; /* Invalid prop.: font-vendor */ 2.822 - font-variant: small-caps } 2.823 -em em { font-style: normal } 2.824 -</PRE> 2.825 - 2.826 -<p> The second declaration on the first line has an invalid value 2.827 -'12pt'. The second declaration on the second line contains an 2.828 -undefined property 'font-vendor'. The CSS3 parser will <span 2.829 -class="index">ignore</span> these 2.830 -declarations, effectively reducing the style sheet to: 2.831 - 2.832 -<PRE class="example"> 2.833 -h1 { color: red; } 2.834 -p { color: blue; font-variant: small-caps } 2.835 -em em { font-style: normal } 2.836 -</PRE> 2.837 -</div> 2.838 - 2.839 -<h3><dfn>Comments</dfn></h3> 2.840 - 2.841 -<p><span class="index">Comments </span> begin 2.842 -with the characters "/*" and end with the characters "*/". They may 2.843 -occur anywhere between tokens, 2.844 -and their contents have no influence on the rendering. Comments may 2.845 -not be nested. 2.846 - 2.847 -<p>CSS also allows the SGML comment delimiters ("<!--" and 2.848 -"-->") in certain places, but they do not delimit CSS 2.849 -comments. They are permitted so that style rules appearing in an HTML 2.850 -source document (in the STYLE element) may be hidden from pre-HTML 3.2 2.851 -user agents. See the HTML 4.0 specification ([[!HTML40]]) for more information. 2.852 - 2.853 -<h2 id="error-handling">Rules for handling parsing errors or unsupported features</h2> 2.854 - 2.855 -<p class="issue">[Hopefully (assuming it can be formalized within the 2.856 -rules above) this section will not need so much detail and can be folded 2.857 -into the previous section.]</p> 2.858 - 2.859 -<p>In some cases, user agents must ignore part of an illegal style 2.860 -sheet. This specification defines <dfn>ignore</dfn> to mean 2.861 -that the user agent parses the illegal part according to the grammar 2.862 -above (in order to find its 2.863 -beginning and end), but otherwise acts as if it had not been there.</p> 2.864 - 2.865 -<p>If a style sheet cannot be parsed according to the grammar above, the 2.866 -user agent must behave the same as it would if the style sheet had the 2.867 -smallest sequence of characters removed from its end that would allow 2.868 -it to be parsed according to the grammar.</p> 2.869 - 2.870 -<p>To ensure that new properties and new values for existing 2.871 -properties can be added in the future, user agents are required to 2.872 -obey the following rules when they encounter the following 2.873 -scenarios:</p> 2.874 - 2.875 -<UL> 2.876 -<LI><strong>Unknown properties.</strong> User agents must <span 2.877 -class="index">ignore</span> a <a 2.878 -href="#declarations">declaration</a> with an unknown 2.879 -property. For example, if the style sheet is: 2.880 - 2.881 -<PRE class="illegal example"> 2.882 -h1 { color: red; rotation: 70minutes } 2.883 -</PRE> 2.884 - 2.885 -<p> the user agent will treat this as if the style sheet had been 2.886 - 2.887 -<PRE class="example"> 2.888 -H1 { color: red } 2.889 -</PRE> 2.890 - 2.891 -<LI id="illegalvalues"><strong>Illegal values.</strong> User agents must ignore a 2.892 -declaration with an illegal value. For example: 2.893 - 2.894 -<PRE class="illegal example"> 2.895 -img { float: left } /* correct CSS3 */ 2.896 -img { float: left here } /* "here" is not a value of 'float' */ 2.897 -img { background: "red" } /* keywords cannot be quoted in CSS3 */ 2.898 -img { border-width: 3 } /* a unit must be specified for length values */ 2.899 -</PRE> 2.900 - 2.901 -A CSS3 parser would honor the first rule and 2.902 -<span class="index">ignore</span> 2.903 -the rest, as if the style sheet had been: 2.904 - 2.905 -<PRE class="example"> 2.906 -img { float: left } 2.907 -img { } 2.908 -img { } 2.909 -img { } 2.910 -</PRE> 2.911 - 2.912 -<p>A user agent conforming to a future CSS specification may accept one or 2.913 -more of the other rules as well.</p> 2.914 - 2.915 -<p class="issue">[A general comment on how to handle negative numbers 2.916 -when disallowed might be useful. It should be a parsing error (and thus 2.917 -ignored). We might want to add additional grammar productions for 2.918 -potentially negative numbers.]</p> 2.919 - 2.920 -</li> 2.921 - 2.922 -<li><strong>Malformed declarations.</strong> User agents must handle 2.923 -unexpected tokens encountered while parsing a declaration by reading 2.924 -until the end of the declaration, while observing the rules for matching 2.925 -pairs of (), [], {}, "", and '', and correctly handling escapes. For 2.926 -example, a malformed declaration may be missing a property, colon (:) or 2.927 -value. The following are all equivalent: 2.928 - 2.929 -<pre class="example"><code> 2.930 -p { color:green } 2.931 -p { color:green; color } /* malformed declaration missing ':', value */ 2.932 -p { color:red; color; color:green } /* same with expected recovery */ 2.933 -p { color:green; color: } /* malformed declaration missing value */ 2.934 -p { color:red; color:; color:green } /* same with expected recovery */ 2.935 -p { color:green; color{;color:maroon} } /* unexpected tokens { } */ 2.936 -p { color:red; color{;color:maroon}; color:green } /* same with recovery */ 2.937 -</code></pre> 2.938 - 2.939 -</li> 2.940 - 2.941 - 2.942 -<LI><strong>Invalid at-keywords.</strong> User agents must <span 2.943 -class="index">ignore</span> an 2.944 -invalid at-keyword together with everything following it, up to and 2.945 -including the next semicolon (;) or block ({...}), whichever 2.946 -comes first. For example, consider the following: 2.947 - 2.948 -<PRE class="illegal example"> 2.949 -@three-dee { 2.950 - @background-lighting { 2.951 - azimuth: 30deg; 2.952 - elevation: 190deg; 2.953 - } 2.954 - h1 { color: red } 2.955 -} 2.956 -h1 { color: blue } 2.957 -</PRE> 2.958 - 2.959 -<p> The '@three-dee' at-rule is not part of CSS3. Therefore, the whole 2.960 -at-rule (up to, and including, the third right curly brace) is <span 2.961 -class="index" title="ignore">ignored.</span> A 2.962 -CSS3 user agent <span class="index" title="ignore">ignores</span> it, effectively reducing the style sheet 2.963 -to:</p> 2.964 - 2.965 -<PRE class="example"> 2.966 -h1 { color: blue } 2.967 -</PRE> 2.968 -</li> 2.969 - 2.970 -<li id="unsupportedvalues"> 2.971 - 2.972 -<p><strong>Unsupported Values</strong>If a UA does not support a 2.973 -particular value, it should <em>ignore</em> that value when parsing 2.974 -stylesheets, as if that value was an <a href="#illegalvalues">illegal 2.975 -value</a>. For example:</p> 2.976 - 2.977 -<div class="example"> 2.978 -<pre> 2.979 - h3 { 2.980 - display: inline; 2.981 - display: run-in; 2.982 - } 2.983 -</pre> 2.984 -</div> 2.985 - 2.986 -<p> 2.987 -A UA that supports the 'run-in' value for the 'display' property will 2.988 -accept the first display declaration and then "write over" that value with 2.989 -the second display declaration. A UA that does not support the 'run-in' 2.990 -value will process the first display declaration and ignore the second 2.991 -display declaration. 2.992 -</p> 2.993 - 2.994 -</li> 2.995 - 2.996 -</UL> 2.997 - 2.998 -<h3>Partial implementations</h3> 2.999 - 2.1000 -<p>CSS3, unlike CSS1 and CSS2, is modular and thus allows for partial 2.1001 -implementations. The conformance requirements of some modules may also allow 2.1002 -for conformant implementations to implement only part of a module.</p> 2.1003 - 2.1004 -<p>Implementations that do not implement a feature of any CSS3 module 2.1005 -(whether a property, an at-rule, or a property value) should behave as 2.1006 -they would according to the forward-compatible parsing rules had that 2.1007 -feature not been part of a known CSS specification.</p> 2.1008 - 2.1009 -<h2>Vendor-specific extensions</h2> 2.1010 - 2.1011 -<p>Although proprietary extensions should be avoided in general, there 2.1012 -are situations (experiments, implementations of W3C drafts that have not 2.1013 -yet reached Candidate Recommendation, intra-nets, debugging, etc.) where 2.1014 -it is convenient to add some nonstandard, i.e., proprietary identifiers 2.1015 -to a CSS style sheet. It is often hard to predict how long these 2.1016 -proprietary extensions will be in use and hard to avoid that their names 2.1017 -clash with new, standard properties or with other proprietary 2.1018 -properties. Therefore the CSS Working Group proposes the following 2.1019 -simple naming convention. A proprietary name should have a prefix 2.1020 -consisting of:</p> 2.1021 - 2.1022 -<ol> 2.1023 - <li>an underscore ("_") or a dash ("-"),</li> 2.1024 - <li>the (possibly abbreviated) name of the company, organization, etc. that 2.1025 - created it,</li> 2.1026 - <li>an underscore or a dash.</li> 2.1027 -</ol> 2.1028 - 2.1029 -<p>Some examples (and the companies/organizations that created them):</p> 2.1030 -<ul> 2.1031 - <li><em>-moz-box-sizing,</em> <em>-moz-border-radius</em> (The Mozilla 2.1032 - Organization)</li> 2.1033 - <li><em>-wap-accesske</em>y (The WAP Forum)</li> 2.1034 - <li><em>_xyz-dwiw</em> (hypothetical)</li> 2.1035 -</ul> 2.1036 - 2.1037 -<p>The advantage of the initial dash is that it is not a valid start character 2.1038 -for identifiers in CSS, so it is guaranteed never to be used by any current or 2.1039 -future level of CSS. CSS-conforming parsers will skip rules that contain 2.1040 -identifiers with such a character. 2.1041 -<span class="issue">[Should the grammar allow 2.1042 -'-' as part of identifiers or should it require that vendors who use '-' to 2.1043 -begin identifiers extend the grammar in their tokenizer? Currently it 2.1044 -does, but perhaps it shouldn't.]</span></p> 2.1045 - 2.1046 -<p>That is also a possible disadvantage: a conforming parser will skip them, 2.1047 -so in order to use them, an extended parser is required.</p> 2.1048 - 2.1049 -<p>For that reason, the underscore is also proposed. Although it is a valid 2.1050 -start character, the CSS Working Group believes it will never define any 2.1051 -identifiers that start with that character.</p> 2.1052 - 2.1053 -<h3>Historical notes</h3> 2.1054 - 2.1055 -<p><em>This section is informative, not normative.</em></p> 2.1056 - 2.1057 -<p>Microsoft created a number of proprietary properties for use inside their 2.1058 -Microsoft Office product, at a time when there was not yet a consensus in the 2.1059 -working group about the naming convention. They chose to prefix properties 2.1060 -with "mso-" rather than "-mso-".</p> 2.1061 - 2.1062 -<p>At the time of writing, the following prefixes are known to exist:</p> 2.1063 -<ul> 2.1064 - <li><em>mso-</em> (Microsoft Corporation)</li> 2.1065 - <li><em>-moz-</em> (The Mozilla Organization)</li> 2.1066 - <li><em>-o-</em> (Opera Software)</li> 2.1067 - <li><em>-atsc</em>- (Advanced Television Standards Committee)</li> 2.1068 - <li><em>-wap-</em> (The WAP Forum)</li> 2.1069 -</ul> 2.1070 - 2.1071 -<h2 id="conf">Conformance</h2> 2.1072 - 2.1073 -<p>The key words <dfn>"MUST"</dfn>, 2.1074 -<dfn>"MUST NOT"</dfn>, <dfn>"REQUIRED"</dfn>, <dfn>"SHALL"</dfn>, <dfn 2.1075 ->"SHALL NOT"</dfn>, <dfn>"SHOULD"</dfn>, <dfn>"SHOULD NOT"</dfn>, 2.1076 -<dfn>"RECOMMENDED"</dfn>, <dfn>"MAY"</dfn>, and <dfn>"OPTIONAL"</dfn> in this document 2.1077 -are to be interpreted as described in RFC 2119 (see [[!RFC2119]]). 2.1078 -However, for readability, these words do not appear in all uppercase 2.1079 -letters in this specification.</p> 2.1080 - 2.1081 -<h3>Definitions</h3> 2.1082 - 2.1083 -<p class="issue">[Some of these need heavy rewriting given 2.1084 -modularization. I've avoided substituting CSS3 where it's clearly not 2.1085 -going to be appropriate.]</p> 2.1086 - 2.1087 -<p>This module and other CSS3 modules rely on the following 2.1088 -definitions:</p> 2.1089 - 2.1090 -<dl> 2.1091 - 2.1092 -<dt><dfn>Style sheet</dfn> 2.1093 - 2.1094 -<dd>A set of statements that specify presentation of a document. 2.1095 - 2.1096 -<p>Style sheets may have three different origins: <a 2.1097 -href="#author">author</a>, <a href="#user">user</a>, and <a 2.1098 -href="#user-agent">user agent</a>. The interaction of these sources is 2.1099 -described in the cascading and 2.1100 -inheritance module [[!CSS3CASCADE]].</p> 2.1101 - 2.1102 -<dt><dfn>Valid style sheet</dfn> 2.1103 - 2.1104 -<dd>The validity of a style sheet depends on the level of CSS 2.1105 -used for the style sheet. All valid CSS1 style sheets are valid CSS 2.1 2.1106 -style sheets, but some changes from CSS1 mean that 2.1107 -a few CSS1 style sheets will have slightly different semantics in 2.1108 -CSS 2.1. Some features in CSS2 are not part of CSS 2.1, so not all CSS2 2.1109 -style sheets are valid CSS 2.1 style sheets. 2.1110 - 2.1111 -<P>A valid CSS 2.1 style sheet must be written according to the <a 2.1112 -href="#detailed-grammar">grammar of CSS 2.1</a>. Furthermore, it must contain 2.1113 -only at-rules, property names, and property values defined in this 2.1114 -specification. An <dfn>illegal</dfn> (invalid) at-rule, 2.1115 -property name, or property value is one that is not valid. 2.1116 - 2.1117 -<dt><dfn>Ignore</dfn> 2.1118 - 2.1119 -<dd>This term has three slightly different meanings in this specification. 2.1120 -First, a CSS parser must follow certain rules when it discovers unknown 2.1121 -or illegal syntax in a style sheet. The parser must then ignore certain 2.1122 -parts of the style sheets. The exact rules for what parts must be 2.1123 -ignored is given in these section: <a href="#declaration">Declarations 2.1124 -and properties</a>, <a href="#error-handling">Rules for handling parsing 2.1125 -errors</a>, <a href="#unsupportedvalues">Unsupported Values</a>, or may be 2.1126 -explained in the text where the term "ignore" appears. Second, a user 2.1127 -agent may (and, in some cases must) disregard certain properties or 2.1128 -values in the style sheet even if the syntax is legal. For example, 2.1129 -table-column-group elements cannot have borders around them, so the 2.1130 -border properties must be ignored. 2.1131 - 2.1132 -<dt><dfn>Author</dfn> 2.1133 -<dd>An author is a person who writes 2.1134 -documents and associated style sheets. An 2.1135 -<dfn>authoring tool</dfn> 2.1136 -generates documents and associated style sheets.</dd> 2.1137 - 2.1138 -<dt><dfn>User</dfn> 2.1139 -<dd> A user is a person who interacts with a user agent to view, hear, or 2.1140 -otherwise use a document and its associated style sheet. The user 2.1141 -may provide a personal style sheet that encodes personal 2.1142 -preferences. 2.1143 -</dd> 2.1144 - 2.1145 -<dt><dfn>User agent (UA)</dfn> 2.1146 -<dd>A <dfn title="user agent|UA">user 2.1147 -agent</dfn> is any program that interprets a document written in 2.1148 -the document language and applies associated style sheets according 2.1149 -to the terms of this specification. A user agent may display a 2.1150 -document, read it aloud, cause it to be printed, convert it 2.1151 -to another format, etc.</dd> 2.1152 - 2.1153 -<DD>An HTML user agent is one that supports the HTML 2.x, HTML 3.x, or 2.1154 -HTML 4.x specifications. A user agent that supports XHTML [[XHTML10]], 2.1155 -but not HTML (as listed in the previous sentence) is not considered an 2.1156 -HTML user agent for the purpose of conformance with this 2.1157 -specification. 2.1158 - 2.1159 -</dl> 2.1160 - 2.1161 - 2.1162 -<h3 id="conf-UA">User agent conformance</h3> 2.1163 - 2.1164 -<p class="issue">[This section should contain rules for user style sheet 2.1165 -conformance, author style sheet disabling, handling parsing errors, 2.1166 -etc., from the CSS2.1 specification.]</p> 2.1167 - 2.1168 - 2.1169 -<h4>Error conditions</h4> 2.1170 - 2.1171 -<P>In general, this document does not specify error handling behavior 2.1172 -for user agents (e.g., how they behave when they cannot find 2.1173 -a resource designated by a URI). 2.1174 - 2.1175 -<P>However, user agents must observe the <a 2.1176 -href="#error-handling">rules for handling parsing errors</a>. 2.1177 - 2.1178 -<P>Since user agents may vary in how they handle error conditions, 2.1179 -authors and users must not rely on specific error recovery behavior. 2.1180 - 2.1181 - 2.1182 -<h3 id="conf-SS">Style sheet conformance</h3> 2.1183 - 2.1184 -<h3 id="conf-AT">Authoring tool conformance</h3> 2.1185 - 2.1186 -<p>Authoring tools may use a modified form of the <a 2.1187 -href="#error-handling">rules for handling parsing errors</a>: when 2.1188 -those rules require that user agents <em>ignore</em> something, 2.1189 -authoring tools are not required to ignore it. However, authoring tools 2.1190 -should not present such parts of the style sheet to the user in the same 2.1191 -way as valid parts of the style sheet. In so far as authoring tools 2.1192 -display the application of a style sheet to a document, they are required 2.1193 -to meet the <a href="#conf-UA">user agent conformance</a> rules.</p> 2.1194 - 2.1195 -<p class="issue">[informative reference to canonicalization proposal?]</p> 2.1196 - 2.1197 - 2.1198 -<h2 id="property-defs">Format of property definitions in other modules</h2> 2.1199 - 2.1200 -<p>Each CSS property definition begins with a summary of key 2.1201 -information that resembles the following:</p> 2.1202 - 2.1203 -<div class="propdef"> 2.1204 -<dl> 2.1205 -<dt><dfn class="propdef-title">'property-name'</dfn> 2.1206 - 2.1207 -<dd> 2.1208 -<table class="propinfo" cellspacing=0 cellpadding=0> 2.1209 -<tr valign=baseline><td><em>Value:</em> <td>legal values 2.1210 -& syntax 2.1211 -<tr valign=baseline><td><em>Initial:</em> <td>initial value 2.1212 -<tr valign=baseline><td><em>Applies to:</em> <td>elements 2.1213 -this property applies to 2.1214 -<tr valign=baseline><td><em>Inherited:</em> <td>whether the 2.1215 -property is inherited 2.1216 -<tr valign=baseline><td><em>Computed Value:</em> <td>the 2.1217 -computed value of the property 2.1218 -<tr valign=baseline><td><em>Percentages:</em> <td>how 2.1219 -percentage values are interpreted 2.1220 -<tr valign=baseline><td><em>Media:</em> <td>which media 2.1221 -groups the property applies to 2.1222 -</table> 2.1223 - 2.1224 -</dl> 2.1225 -</div> 2.1226 - 2.1227 -<h3 id="property-def-value">Value</h3> 2.1228 - 2.1229 -<p>This part specifies the set of valid values for the property. Value 2.1230 -types may be designated in several ways: 2.1231 - 2.1232 -<ol> 2.1233 -<li> keyword values (e.g., auto, disc, etc.) 2.1234 - 2.1235 -<li> basic data types, which appear between "<" and ">" (e.g., 2.1236 -<length>, <percentage>, etc.). In the electronic version 2.1237 -of the document, each instance of a basic data type links to its 2.1238 -definition. 2.1239 - 2.1240 -<li> types that have the same range of values as a property bearing 2.1241 -the same name (e.g., <'border-width'> 2.1242 -<'background-attachment'>, etc.). In this case, the type name 2.1243 -is the property name (complete with quotes) between "<" and ">" 2.1244 -(e.g., <'border-width'>). Such a type does <strong>not</strong> 2.1245 -include the value 'inherit'. In the electronic version of the 2.1246 -document, each instance of this type of non-terminal links to the 2.1247 -corresponding property definition. 2.1248 - 2.1249 - 2.1250 -<li> non-terminals that do not share the same name as a property. In this 2.1251 -case, the non-terminal name appears between "<" and ">", as in 2.1252 -<border-width>. Notice the distinction between 2.1253 -<border-width> and <'border-width'>; the latter is defined 2.1254 -in terms of the former. The definition of a non-terminal is located 2.1255 -near its first appearance in the specification. In the electronic 2.1256 -version of the document, each instance of this type of value links to 2.1257 -the corresponding value definition. 2.1258 -</ol> 2.1259 - 2.1260 -<p>Other words in these definitions are keywords that must appear 2.1261 -literally, without quotes (e.g., red). The slash (/) and the comma (,) 2.1262 -must also appear literally. 2.1263 - 2.1264 -<p>Values may be arranged as follows:</p> 2.1265 - 2.1266 -<ul> 2.1267 -<li>Several juxtaposed words mean that all of them must occur, in the 2.1268 -given order. 2.1269 -<li>A bar (|) separates two or more alternatives: 2.1270 -exactly one of them must occur. 2.1271 -<li>A double bar (||) separates 2.1272 -two or more options: one or more of them must occur, in any order. 2.1273 -<li>Brackets ([ ]) are for grouping. 2.1274 -</ul> 2.1275 - 2.1276 -<p>Juxtaposition is stronger than the double bar, and the double bar 2.1277 -is stronger than the bar. Thus, the following lines are equivalent: 2.1278 -<PRE> 2.1279 - a b | c || d e 2.1280 - [ a b ] | [ c || [ d e ]] 2.1281 -</PRE> 2.1282 - 2.1283 -<p> Every type, keyword, or bracketed group may be followed by one of 2.1284 -the following modifiers:</p> 2.1285 - 2.1286 - <UL> 2.1287 - <LI> 2.1288 - An asterisk (*) indicates that the preceding type, word, or group 2.1289 - occurs zero or more times. 2.1290 - 2.1291 - <LI> 2.1292 - A plus (+) indicates that the preceding type, word, or group 2.1293 - occurs one or more times. 2.1294 - 2.1295 - <LI> 2.1296 - A question mark (?) indicates that the preceding type, word, or 2.1297 - group is optional. 2.1298 - 2.1299 - <LI> 2.1300 - A pair of numbers in curly braces ({A,B}) indicates that the 2.1301 - preceding type, word, or group occurs at least A and at most 2.1302 - B times. 2.1303 - </UL> 2.1304 - 2.1305 - 2.1306 -<p>The following examples illustrate different value types: 2.1307 - 2.1308 -<BLOCKQUOTE> 2.1309 - <EM>Value:</EM> N | NW | NE<BR> 2.1310 - <EM>Value:</EM> [ <length> | thick | thin ]{1,4}<BR> 2.1311 - <EM>Value:</EM> [<family-name> , ]* <family-name><BR> 2.1312 - <EM>Value:</EM> <uri>? <color> [ / <color> ]?<BR> 2.1313 - <EM>Value:</EM> <uri> || <color><BR> 2.1314 -</BLOCKQUOTE> 2.1315 - 2.1316 -<p>See the values and units [[!CSS3VAL]] module for the formal 2.1317 -definitions of the basic values types.</p> 2.1318 - 2.1319 -<p class="issue">[We need a more formal grammar for parsing of 2.1320 -properties. Refer to section on keywords (they can't be quoted).]</p> 2.1321 - 2.1322 -<h4><code>initial</code> and <code>inherit</code> values</h4> 2.1323 - 2.1324 -<p>In addition to the legal values stated, <code>initial</code> and 2.1325 -<code>inherit</code> values are also legal for every property. The 2.1326 -meaning of these values is described in the Values & Units 2.1327 -[[!CSS3VAL]] and Cascading & Inheritance [[!CSS3CASCADE]] modules. 2.1328 -</p> 2.1329 - 2.1330 -<h3 id="property-def-initial">Initial</h3> 2.1331 - 2.1332 -<p>This part specifies the property's initial value. If the property 2.1333 -is <a href="#property-def-inherited">inherited</a>, this is the value 2.1334 -that is given to the root element of the <span>document tree</span>. 2.1335 -Please consult 2.1336 -the the Cascading & Inheritance module [[!CSS3CASCADE]] for information 2.1337 -about the interaction between style sheet-specified, inherited, and 2.1338 -initial values. 2.1339 - 2.1340 - 2.1341 -<h3 id="property-def-applies">Applies to</h3> 2.1342 - 2.1343 -<p>This part lists the elements to which the property applies. All 2.1344 -elements are considered to have all properties, but some properties 2.1345 -have no rendering effect on some types of elements. For example, <span 2.1346 -class="propinst-white-space">'white-space'</span> only affects 2.1347 -block-level elements. 2.1348 - 2.1349 -<h3 id="property-def-inherited">Inherited</h3> 2.1350 - 2.1351 -<p>This part indicates whether the value of the property is inherited 2.1352 -from an ancestor element by default ("Inherited: yes") or the 2.1353 -value of the property is its <a href="#property-def-initial">initial 2.1354 -value</a> by default ("Inherited: no"). Please consult the Cascading 2.1355 -& Inheritance Module [[!CSS3CASCADE]] for information about the 2.1356 -interaction between style sheet-specified, inherited, and initial 2.1357 -values.</p> 2.1358 - 2.1359 -<h3 id="property-def-computed">Computed value</h3> 2.1360 - 2.1361 -<p>This part indicates the computed value of the property. The concept 2.1362 -of computed value is described in the Cascading & Inheritance Module 2.1363 -[[!CSS3CASCADE]]. (It is needed both for inheritance and for the 2.1364 -definitions of some DOM properties.)</p> 2.1365 - 2.1366 -<p>When the computed value line says "as specified", then for the 2.1367 -special <span>'initial'</span> and <span>'inherit'</span> values, the 2.1368 -computed value is as though the initial value or the inherited value had 2.1369 -been specified -- it is not 'initial' or 'inherit' itself. <span 2.1370 -class="issue">[Check this with the definition of "specified value". It 2.1371 -may not be needed.]<span></p> 2.1372 - 2.1373 -<p class="issue">[What is the computed value for elements to which the 2.1374 -property does not apply? Do some existing inherited properties rely on 2.1375 -inheritance through elements to which the property doesn't apply?]</p> 2.1376 - 2.1377 -<h3 id="property-def-percent">Percentage values</h3> 2.1378 - 2.1379 -<p>This part indicates how percentages should be interpreted, if they occur in 2.1380 -the value of the property. If "N/A" appears here, it means that the 2.1381 -property does not accept percentages as values. 2.1382 - 2.1383 -<h3 id="media-groups">Media groups</h3> 2.1384 - 2.1385 -<p class="issue">[Some of this needs to be relaxed to deal with 2.1386 -profiles.]</p> 2.1387 - 2.1388 -<P><em>This section is informative, not normative.</em></P> 2.1389 - 2.1390 -<p>This part indicates the media groups for which the property must be 2.1391 -implemented by a conforming user agent. 2.1392 -Since properties 2.1393 -generally apply to several media, the "Applies to media" section of each 2.1394 -property definition lists media groups rather than individual media 2.1395 -types. 2.1396 -User agents must support the 2.1397 -property if they support rendering to the media types included in 2.1398 -these media groups. 2.1399 -Each property applies to all media types in the media groups 2.1400 -listed in its definition. 2.1401 -</p> 2.1402 - 2.1403 -<P>CSS3 defines the following media groups: </P> 2.1404 -<ul> 2.1405 -<li> 2.1406 -<dfn title="'continuous' media group">continuous</dfn> 2.1407 -or <dfn title="'paged' media group">paged</dfn>. 2.1408 - 2.1409 -<li><dfn title="'visual' media group">visual,</dfn> 2.1410 -<dfn title="'audio' media group">audio,</dfn> 2.1411 -<dfn title="'speech' media group">speech,</dfn> 2.1412 -or <dfn title="'tactile' media group">tactile</dfn>. 2.1413 -<li><dfn title="'grid' media group">grid</dfn> (for 2.1414 -character grid devices), or 2.1415 -<dfn title="'bitmap' media group">bitmap</dfn>. 2.1416 - 2.1417 -<li><dfn title="'interactive' media group">interactive</dfn> (for 2.1418 -devices that allow user interaction), or 2.1419 -<dfn title="'static' media group">static</dfn> (for 2.1420 -those that don't). 2.1421 - 2.1422 -<li><dfn title="'all' media group">all</dfn> (includes all media 2.1423 -types) 2.1424 -</ul> 2.1425 - 2.1426 -<p>The following table shows the relationships 2.1427 -between media groups and media types:</p> 2.1428 - 2.1429 -<TABLE border 2.1430 - summary="Relationship between media groups and media types"> 2.1431 -<CAPTION>Relationship between media groups and media types</CAPTION> 2.1432 -<TR><TH>Media Types <TH colspan="4">Media Groups 2.1433 -<TR><TH> 2.1434 - <TH>continuous/paged 2.1435 - <TH>visual/audio/speech/tactile 2.1436 - <TH>grid/bitmap 2.1437 - <TH>interactive/static 2.1438 -<!-- 2.1439 -<TR><TH>audio<TD align="center">continuous<TD align="center">audio<TD align="center">N/A<TD align="center">both</TR> 2.1440 ---> 2.1441 -<TR><TH>braille<TD align="center">continuous<TD align="center">tactile<TD align="center">grid<TD align="center">both</TR> 2.1442 -<TR><TH>embossed<TD align="center">paged<TD align="center">tactile<TD align="center">grid<TD align="center">static</TR> 2.1443 -<TR><TH>handheld<TD align="center">both<TD align="center">visual, audio, speech<TD 2.1444 -align="center">both<TD align="center">both</TR> 2.1445 -<TR><TH>print<TD align="center">paged<TD align="center">visual<TD 2.1446 -align="center">bitmap<TD align="center">static</TR> 2.1447 -<TR><TH>projection<TD align="center">paged<TD align="center">visual<TD align="center">bitmap<TD align="center">interactive</TR> 2.1448 -<TR><TH>screen<TD align="center">continuous<TD align="center">visual, audio<TD align="center">bitmap<TD align="center">both</TR> 2.1449 -<TR><TH>speech<TD align="center">continuous<TD align="center">speech<TD align="center">N/A<TD align="center">both</TR> 2.1450 -<TR><TH>tty<TD align="center">continuous<TD align="center">visual<TD align="center">grid<TD align="center">both</TR> 2.1451 -<TR><TH>tv<TD align="center">both<TD align="center">visual, audio<TD align="center">bitmap<TD align="center">both</TR> 2.1452 -</TABLE> 2.1453 - 2.1454 -<h3>Shorthand properties</h3> 2.1455 - 2.1456 -<p>Some properties are <dfn title="shorthand 2.1457 -property">shorthand properties</dfn>, meaning they allow 2.1458 -authors to specify the values of several properties with a single 2.1459 -property.</p> 2.1460 - 2.1461 -<p>For instance, the <span class="propinst-font">'font'</span> property 2.1462 -is a shorthand property for setting <span 2.1463 -class="propinst-font-style">'font-style'</span>, <span 2.1464 -class="propinst-font-variant">'font-variant'</span>, <span 2.1465 -class="propinst-font-weight">'font-weight'</span>, <span 2.1466 -class="propinst-font-size">'font-size'</span>, <span 2.1467 -class="propinst-line-height">'line-height'</span>, and <span 2.1468 -class="propinst-font-family">'font-family'</span> all at once.</p> 2.1469 - 2.1470 -<p>The syntax of a shorthand property may allow some of the properties 2.1471 -that can be specified by that shorthand to be omitted. When such values 2.1472 -are omitted from a shorthand form, each "missing" property is assigned 2.1473 -its initial value (see the Cascading & Inheritance module 2.1474 -[[!CSS3CASCADE]]). The definition of a shorthand property may further say 2.1475 -that it resets the definitions of other properties to their initial 2.1476 -value.</p> 2.1477 - 2.1478 -<div class="example"><p> 2.1479 -The multiple style rules of this example:</p> 2.1480 - 2.1481 -<pre> 2.1482 -h1 { 2.1483 - font-weight: bold; 2.1484 - font-size: 2em; 2.1485 - line-height: 1.2; 2.1486 - font-family: Helvetica, Arial, sans-serif; 2.1487 - font-variant: normal; 2.1488 - font-style: normal; 2.1489 - font-stretch: normal; 2.1490 - font-size-adjust: none 2.1491 -} 2.1492 -</pre> 2.1493 - 2.1494 -<p>may be rewritten with a single shorthand property:</p> 2.1495 - 2.1496 -<pre> 2.1497 -h1 { font: bold 2em/1.2 Helvetica, Arial, sans-serif } 2.1498 -</pre> 2.1499 - 2.1500 -<p>In this example, <span 2.1501 -class="propinst-font-variant">'font-variant'</span>, <span 2.1502 -class="propinst-font-stretch">'font-stretch'</span>, <span 2.1503 -class="propinst-font-size-adjust">'font-size-adjust'</span>, and <span 2.1504 -class="propinst-font-style">'font-style'</span> 2.1505 -take their initial values.</p> 2.1506 -</div> 2.1507 - 2.1508 -<h2 id="detailed-grammar">Appendix: Second grammar</h2> 2.1509 - 2.1510 -<p class="issue">[This grammar was the Appendix D grammar of CSS2, 2.1511 -augmented by the additions from the @namespace draft. It needs to be 2.1512 -incorporated into the above normative text in some way.]</p> 2.1513 - 2.1514 -<p>The grammar below defines the syntax of CSS2. It is in some sense, 2.1515 -however, a superset of CSS2 as this specification imposes additional 2.1516 -semantic constraints not expressed in this grammar. A conforming UA 2.1517 -must also adhere to the <a href="#syntax"> 2.1518 -forward-compatible parsing rules</a>, the <a 2.1519 -href="#property-defs">property and value notation</a>, 2.1520 -and the unit notation. In 2.1521 -addition, the document language may impose restrictions, e.g. HTML 2.1522 -imposes restrictions on the possible values of the "class" 2.1523 -attribute.</p> 2.1524 - 2.1525 -<!-- IJ: There used to be a link to "unit notation", but I couldn't 2.1526 -find anything in the spec that corresponded. --> 2.1527 - 2.1528 -<h3>Grammar</h3> 2.1529 - 2.1530 -<p>The grammar below is <span class="index" 2.1531 -title="LL(1)">LL(1)</span> (but note that most UA's should not use it 2.1532 -directly, since it doesn't express the forward-compatible <a 2.1533 -href="#syntax">parsing conventions</a>, only the 2.1534 -CSS3 syntax). The format of the productions is optimized for human 2.1535 -consumption and some shorthand notation beyond Yacc (see [[YACC]]) is 2.1536 -used:</p> 2.1537 - 2.1538 -<p class="issue">[It's probably not LL(1), but rather just LALR(1).]</p> 2.1539 - 2.1540 -<p class="issue">[This needs a lot more revisions to reflect all the 2.1541 -additions in CSS3.]</p> 2.1542 - 2.1543 -<p class="issue">[This doesn't allow nested at-rules, such as 2.1544 -<code>@page</code> inside <code>@media</code>. Do we want to allow 2.1545 -this?]</p> 2.1546 - 2.1547 -<ul> 2.1548 -<li><strong>*</strong>: 0 or more 2.1549 -<li><strong>+</strong>: 1 or more 2.1550 -<li><strong>?</strong>: 0 or 1 2.1551 -<li><strong>|</strong>: separates alternatives 2.1552 -<li><strong>[ ]</strong>: grouping 2.1553 -</ul> 2.1554 - 2.1555 -<p>The productions are: 2.1556 - 2.1557 -<pre> 2.1558 -stylesheet 2.1559 - : [ CHARSET_SYM S* STRING S* ';' ]? 2.1560 - [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* 2.1561 - [ namespace [S|CDO|CDC]* ]* 2.1562 - [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]* 2.1563 - ; 2.1564 -import 2.1565 - : IMPORT_SYM S* 2.1566 - [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S* 2.1567 - ; 2.1568 -namespace 2.1569 - : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* 2.1570 - ; 2.1571 -namespace_prefix 2.1572 - : IDENT 2.1573 - ; 2.1574 -media 2.1575 - : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S* 2.1576 - ; 2.1577 -medium 2.1578 - : IDENT S* 2.1579 - ; 2.1580 -page 2.1581 - : PAGE_SYM S* IDENT? pseudo_page? S* 2.1582 - '{' S* declaration [ ';' S* declaration ]* '}' S* 2.1583 - ; 2.1584 -pseudo_page 2.1585 - : ':' IDENT 2.1586 - ; 2.1587 -font_face 2.1588 - : FONT_FACE_SYM S* 2.1589 - '{' S* declaration [ ';' S* declaration ]* '}' S* 2.1590 - ; 2.1591 -operator 2.1592 - : '/' S* | ',' S* | /* empty */ 2.1593 - ; 2.1594 -combinator 2.1595 - : '+' S* | '>' S* | /* empty */ 2.1596 - ; 2.1597 -unary_operator 2.1598 - : '-' | '+' 2.1599 - ; 2.1600 -property 2.1601 - : IDENT S* 2.1602 - ; 2.1603 -ruleset 2.1604 - : selector [ ',' S* selector ]* 2.1605 - '{' S* declaration [ ';' S* declaration ]* '}' S* 2.1606 - ; 2.1607 -<span class="index">selector</span> 2.1608 - : simple_selector [ combinator simple_selector ]* 2.1609 - ; 2.1610 -simple_selector 2.1611 - : element_name? [ HASH | class | attrib | pseudo ]* S* 2.1612 - ; 2.1613 -class 2.1614 - : '.' IDENT 2.1615 - ; 2.1616 -element_name 2.1617 - : IDENT | '*' 2.1618 - ; 2.1619 -attrib 2.1620 - : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* 2.1621 - [ IDENT | STRING ] S* ]? ']' 2.1622 - ; 2.1623 -pseudo 2.1624 - : ':' [ IDENT | FUNCTION S* IDENT S* ')' ] 2.1625 - ; 2.1626 -declaration 2.1627 - : property ':' S* expr prio? 2.1628 - | /* empty */ 2.1629 - ; 2.1630 -prio 2.1631 - : IMPORTANT_SYM S* 2.1632 - ; 2.1633 -expr 2.1634 - : term [ operator term ]* 2.1635 - ; 2.1636 -term 2.1637 - : unary_operator? 2.1638 - [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* | 2.1639 - TIME S* | FREQ S* | function ] 2.1640 - | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor 2.1641 - ; 2.1642 -function 2.1643 - : FUNCTION S* expr ')' S* 2.1644 - ; 2.1645 -/* 2.1646 - * There is a constraint on the <span class="index">color</span> that it must 2.1647 - * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) 2.1648 - * after the "#"; e.g., "#000" is OK, but "#abcd" is not. 2.1649 - */ 2.1650 -hexcolor 2.1651 - : HASH S* 2.1652 - ; 2.1653 -</pre> 2.1654 - 2.1655 -<h3>Lexical scanner</h3> 2.1656 - 2.1657 -<p> The following is the <dfn>tokenizer</dfn>, written in Flex (see [[FLEX]]) 2.1658 -notation. The tokenizer is case-insensitive.</p> 2.1659 - 2.1660 -<p>The two occurrences of "\377" represent the highest character 2.1661 -number that current versions of Flex can deal with (decimal 255). They 2.1662 -should be read as "\4177777" (decimal 1114111), which is the highest 2.1663 -possible code point in <span class="index">Unicode</span>/<span class="index">ISO-10646</span>, except excluding the characters 2.1664 -excluded in the <code><a href="#SUBTOK-nonascii">nonascii</a></code> 2.1665 -production above.</p> 2.1666 - 2.1667 -<!-- ignored whitespace after Unicode escape, is it OK? --> 2.1668 -<pre> 2.1669 -%option case-insensitive 2.1670 - 2.1671 -h [0-9a-f] 2.1672 -nonascii [\200-\377] 2.1673 -unicode \\{h}{1,6}[ \t\r\n\f]? 2.1674 -escape {unicode}|\\[ -~\200-\377] 2.1675 -nmstart [a-z]|{nonascii}|{escape} 2.1676 -nmchar [a-z0-9-]|{nonascii}|{escape} 2.1677 -string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\" 2.1678 -string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\' 2.1679 - 2.1680 -ident [-]?{nmstart}{nmchar}* 2.1681 -name {nmchar}+ 2.1682 -num [0-9]+|[0-9]*"."[0-9]+ 2.1683 -string {string1}|{string2} 2.1684 -url ([!#$%&*-~]|{nonascii}|{escape})* 2.1685 -w [ \t\r\n\f]* 2.1686 -nl \n|\r\n|\r|\f 2.1687 -range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h}))))) 2.1688 - 2.1689 -%% 2.1690 - 2.1691 -[ \t\r\n\f]+ {return S;} 2.1692 - 2.1693 -\/\*[^*]*\*+([^/][^*]*\*+)*\/ /* ignore comments */ 2.1694 - 2.1695 -"<!--" {return CDO;} 2.1696 -"-->" {return CDC;} 2.1697 -"~=" {return INCLUDES;} 2.1698 -"|=" {return DASHMATCH;} 2.1699 - 2.1700 -{string} {return STRING;} 2.1701 - 2.1702 -{ident} {return IDENT;} 2.1703 - 2.1704 -"#"{name} {return HASH;} 2.1705 - 2.1706 -"@import" {return IMPORT_SYM;} 2.1707 -"@page" {return PAGE_SYM;} 2.1708 -"@media" {return MEDIA_SYM;} 2.1709 -"@font-face" {return FONT_FACE_SYM;} 2.1710 -"@charset" {return CHARSET_SYM;} 2.1711 -"@namespace" {return NAMESPACE_SYM;} 2.1712 - 2.1713 -"!{w}important" {return IMPORTANT_SYM;} 2.1714 - 2.1715 -{num}em {return EMS;} 2.1716 -{num}ex {return EXS;} 2.1717 -{num}px {return LENGTH;} 2.1718 -{num}cm {return LENGTH;} 2.1719 -{num}mm {return LENGTH;} 2.1720 -{num}in {return LENGTH;} 2.1721 -{num}pt {return LENGTH;} 2.1722 -{num}pc {return LENGTH;} 2.1723 -{num}deg {return ANGLE;} 2.1724 -{num}rad {return ANGLE;} 2.1725 -{num}grad {return ANGLE;} 2.1726 -{num}ms {return TIME;} 2.1727 -{num}s {return TIME;} 2.1728 -{num}Hz {return FREQ;} 2.1729 -{num}kHz {return FREQ;} 2.1730 -{num}{ident} {return DIMEN;} 2.1731 -{num}% {return PERCENTAGE;} 2.1732 -{num} {return NUMBER;} 2.1733 - 2.1734 -"url("{w}{string}{w}")" {return URI;} 2.1735 -"url("{w}{url}{w}")" {return URI;} 2.1736 -{ident}"(" {return FUNCTION;} 2.1737 - 2.1738 -U\+{range} {return UNICODERANGE;} 2.1739 -U\+{h}{1,6}-{h}{1,6} {return UNICODERANGE;} 2.1740 - 2.1741 -. {return *yytext;} 2.1742 -</pre> 2.1743 - 2.1744 - 2.1745 -<h2 class="no-num">Changes from CSS2</h2> 2.1746 - 2.1747 -<p>This section is informative.</p> 2.1748 - 2.1749 -<p> 2.1750 - The parts of CSS2 that have become part of this CSS3 draft are 2.1751 - sections 1.3.2 (1.4.2 in CSS 2.1), 1.3.3 (1.4.3 in CSS2.1), 3 (parts), 2.1752 - 4.1, 4.2, 4.4, and 6.3, 7, and Appendix D. This draft also contains 2.1753 - new material on namespaces and on vendor extensions to CSS that began 2.1754 - as separate documents. 2.1755 -</p> 2.1756 - 2.1757 -<ul> 2.1758 - <li>The text taken from Chapter 1 of CSS2 is now normative rather than 2.1759 - informative.</li> 2.1760 - 2.1761 - <li>added the section on vendor extensions and added the 2.1762 - <span class="css">'-'</span> character to the 2.1763 - ident productions so that identifiers can begin with it</li> 2.1764 - 2.1765 - <li>modified the rules for handling parsing errors 2.1766 - to allow implementations that support only parts of CSS3</li> 2.1767 - 2.1768 - <li>described how style sheets that cannot be parsed according to the 2.1769 - grammar should be handled (by saying that parsing uses the parseable 2.1770 - initial sequence of tokens)</li> 2.1771 - 2.1772 - <li><span class="issue">[to be done]</span> described handling of unmatched quotation marks (by saying that 2.1773 - tokenization uses the tokenizable initial sequence of characters)</li> 2.1774 - 2.1775 - <li><span class="issue">[to be done]</span> formalized the error handling rules by combining the 2.1776 - forward-compatible grammar in chapter 4 with the CSS2 grammar in 2.1777 - Appendix D.</li> 2.1778 - 2.1779 - <li>combined DELIM and other single character tokens into CHAR</li> 2.1780 - 2.1781 - <li>explicitly stated that the byte order mark should be ignored for 2.1782 - purposes of the grammar</li> 2.1783 - 2.1784 - <li>Changed the acceptable characters to exclude surrogate blocks and 2.1785 - #xFFFE, #xFFFF, as in XML.</li> 2.1786 - 2.1787 - <li>Changed the rules on what to do when a character encoding is not 2.1788 - specified.</li> 2.1789 - 2.1790 -</ul> 2.1791 - 2.1792 -<h2 class="no-num">Acknowledgments</h2> 2.1793 - 2.1794 -<p>Since most of this draft is taken from CSS2, it would not have been 2.1795 -possible to write it so easily without the work of the editors and 2.1796 -authors of [[CSS1]] and [[CSS2]]. This draft also borrows heavily from 2.1797 -earlier drafts on CSS namespace support by Peter Linss [[CSS3NAMESPACE]] 2.1798 -and early (unpublished) drafts on vendor extensions to CSS by Bert Bos. 2.1799 -Many current and former members of the working group have contributed to 2.1800 -this document. Discussions on <code><a 2.1801 -href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a></code> 2.1802 -and in other places have also contributed ideas to this specification. 2.1803 -Comments from Glenn Adams, Björn Höhrmann, and Etan Wexler 2.1804 -have been particularly helpful.</p> 2.1805 - 2.1806 -<h2 class="no-num">References</h2> 2.1807 - 2.1808 -<h3 class="no-num">Normative references</h3> 2.1809 - 2.1810 -<!-- begin-normative --> 2.1811 -<p>[Here will be inserted the file "normative.inc"]</p> 2.1812 -<!-- end-normative --> 2.1813 - 2.1814 -<h3 class="no-num">Other references</h3> 2.1815 - 2.1816 -<!-- begin-informative --> 2.1817 -<p>[Here will be inserted the file "informative.inc"]</p> 2.1818 -<!-- end-informative --> 2.1819 - 2.1820 -<h2 class="no-num">Index</h2> 2.1821 -<!--index--> 2.1822 -</body> 2.1823 -<!-- Keep this comment at the end of the file 2.1824 -Local variables: 2.1825 -mode: sgml 2.1826 -sgml-declaration:"~/SGML/HTML4.decl" 2.1827 -sgml-default-doctype-name:"html" 2.1828 -sgml-minimize-attributes:t 2.1829 -sgml-nofill-elements:("pre" "style" "br") 2.1830 -sgml-live-element-indicator:t 2.1831 -End: 2.1832 ---> 2.1833 -</html>