css-style-attr/Overview.src.html

changeset 1610
ddebc39f6d33
parent 1571
76ff35863a28
child 1611
f7c26d1266f9
     1.1 --- a/css-style-attr/Overview.src.html	Tue Jan 05 16:56:03 2010 +0000
     1.2 +++ b/css-style-attr/Overview.src.html	Thu Jan 07 08:25:14 2010 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4  <html lang="en">
     1.5  <head>
     1.6    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     1.7 -  <title>CSS Style Attribute Syntax Level 1</title>
     1.8 +  <title>CSS Styling Attribute Syntax Level 1</title>
     1.9    <link rel="stylesheet" type="text/css" href="../default.css">
    1.10  
    1.11    <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED">
    1.12 @@ -11,7 +11,7 @@
    1.13  <div class="head">
    1.14  <!--logo-->
    1.15  
    1.16 -<h1>CSS Style Attribute Syntax Level 1</h1>
    1.17 +<h1>CSS Styling Attribute Syntax Level 1</h1>
    1.18  
    1.19  <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
    1.20  <dl>
    1.21 @@ -38,10 +38,10 @@
    1.22  
    1.23  <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    1.24  
    1.25 -<p>Markup languages such as HTML and SVG provide a "style" attribute on most
    1.26 +<p>Markup languages such as HTML and SVG provide a styling attribute on most
    1.27  elements, to hold a fragment of a style sheet that applies to those elements.
    1.28  One of the possible style sheet languages is CSS. This draft describes the
    1.29 -syntax of the CSS fragment that can be used in the "style" attribute.
    1.30 +syntax of the CSS fragment that can be used in the styling attribute.
    1.31  
    1.32  <h2 class="no-num no-toc" id="status">Status of this document</h2>
    1.33  <!--status-->
    1.34 @@ -51,11 +51,11 @@
    1.35  
    1.36  <h2 id="intro">Introduction</h2>
    1.37  
    1.38 -<p>Several XML-based document formats have a "style" attribute to permit the
    1.39 -author to directly apply style information to specific elements in documents.
    1.40 -If a document format defines a "style" attribute and the attribute accepts CSS
    1.41 -as its value, then this specification describes the attribute's syntax and
    1.42 -interpretation.
    1.43 +<p>Some document formats have a <dfn>styling attribute</dfn> to permit
    1.44 +the author to directly apply style information to specific elements
    1.45 +in documents. If a document format defines a styling attribute and the
    1.46 +attribute accepts CSS as its value, then this specification defines this
    1.47 +<dfn>CSS styling attribute</dfn>'s syntax and interpretation.
    1.48  
    1.49  <div class="example">
    1.50    <p>The following example shows the use of the <code>style</code> attribute
    1.51 @@ -63,64 +63,19 @@
    1.52    <pre>&lt;p style="<em>color: #090; line-height: 1.2</em>"&gt;...&lt;/p&gt;</pre>
    1.53  </div>
    1.54  
    1.55 -<h2 id="syntax">Syntax</h2>
    1.56 -
    1.57 -<p>The syntax of the style attribute syntax is exactly the same as the
    1.58 -contents of a CSS
    1.59 -<a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration block</a>.
    1.60 -A close brace (<code>}</code>) in the style attribute value does not
    1.61 -terminate the style data; it is merely an invalid token.
    1.62 -
    1.63 -<p>The same rules for forward-compatible parsing apply to the inline style
    1.64 -sheet as to a normal style sheet. See <a href="http://www.w3.org/TR/CSS21/syndata.html">chapter
    1.65 -4 of the CSS2.1 specification</a>. [[!CSS21]]
    1.66 -
    1.67 -<h2 id="grammar">Grammar</h2>
    1.68 -
    1.69 -<p>The syntax of the CSS fragment that is allowed in the HTML "style"
    1.70 -attribute can be formally specified as follows:
    1.71 -
    1.72 -<pre>
    1.73 -inline-stylesheet
    1.74 -  : S* declaration-list
    1.75 -  ;
    1.76 -
    1.77 -declaration-list
    1.78 -  : declaration [ ';' S* declaration ]*
    1.79 -  ;
    1.80 -</pre>
    1.81 -
    1.82 -<p>Please refer to the grammar in <a href="http://www.w3.org/TR/CSS21/grammar.html">appendix D
    1.83 -of the CSS2.1 specification</a> [[!CSS21]] for the definition of the symbols
    1.84 -not defined here.
    1.85 -
    1.86 -<h2 id="interpret">Cascading and Interpretation</h2>
    1.87 -
    1.88 -<p>The declarations in a style attribute apply to the element to which
    1.89 -the attribute belongs. CSS2.1 <a href="/TR/CSS21/cascade.html#specificity">defines</a>
    1.90 -how style sheets and "style" attributes are cascaded together. [[!CSS21]]
    1.91 -Aside from the differences in cascading, the declarations in a style
    1.92 -attribute must be interpreted exactly as if they were given in a CSS
    1.93 -style rule applied to the element.
    1.94 -
    1.95 -<p>The CSS Working Group strongly recommends that document languages do
    1.96 -not allow multiple style attributes on a single element. If a document
    1.97 -language allows multiple style attributes, each is parsed independently
    1.98 -and treated as a separate style rule, the ordering of which should be
    1.99 -defined by the document language, else is undefined.
   1.100 -
   1.101  <h2 id="conformance">Conformance</h2>
   1.102  
   1.103 -<p>A document or implementation cannot conform to CSS Style Attribute Syntax
   1.104 -Level 1 alone, but can claim conformance to CSS Style Attribute Syntax Level 1
   1.105 +<p>A document or implementation cannot conform to CSS Styling Attribute Syntax
   1.106 +Level 1 alone, but can claim conformance to CSS Styling Attribute Syntax Level 1
   1.107  if it satisfies the conformance requirements in this specification when
   1.108 -implementing CSS together with style attribute handling as defined in a
   1.109 -document language that has style attributes.</p>
   1.110 +implementing CSS together with styling attribute handling as defined in a
   1.111 +document language that has CSS styling attributes.</p>
   1.112  
   1.113 -<p>Conformance to CSS Style Attribute Syntax Level 1 is defined for two classes:
   1.114 +<p>Conformance to CSS Styling Attribute Syntax Level 1 is defined for two
   1.115 +classes:
   1.116  <dl>
   1.117    <dt><dfn>document</dfn></dt>
   1.118 -    <dd>A document represented in a document language that defines a style
   1.119 +    <dd>A document represented in a document language that defines a styling
   1.120        attribute for one or more of its elements.
   1.121    <dt><dfn>interpreter</dfn></dt>
   1.122      <dd>Someone or something that interprets the semantics of a document and
   1.123 @@ -152,6 +107,59 @@
   1.124  
   1.125  <p class="note">Note, this is an informative note.</p>
   1.126  
   1.127 +<h2 id="syntax">Syntax and Parsing</h2>
   1.128 +
   1.129 +<p>The value of the styling attribute must match the syntax of the contents of
   1.130 +a CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
   1.131 +block</a>. The interpreter must parse the styling attribute's value using the
   1.132 +same forward-compatible parsing rules that apply to parsing declaration block
   1.133 +contents in a normal CSS style sheet. See
   1.134 +<a href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
   1.135 +specification</a>. [[!CSS21]]
   1.136 +
   1.137 +<p class="note">Note that because there is no open brace delimiting the
   1.138 +declaration list in the CSS styling attribute syntax, a close brace
   1.139 +(<code>}</code>) in the styling attribute's value does not terminate the
   1.140 +style data: it is merely an invalid token.</p>
   1.141 +
   1.142 +<h2 id="grammar">Grammar</h2>
   1.143 +
   1.144 +<p>The syntax of the CSS fragment that is allowed as the CSS styling
   1.145 +attribute's value is formally specified as follows:
   1.146 +
   1.147 +<pre>
   1.148 +inline-stylesheet
   1.149 +  : S* declaration-list
   1.150 +  ;
   1.151 +
   1.152 +declaration-list
   1.153 +  : declaration [ ';' S* declaration ]*
   1.154 +  ;
   1.155 +</pre>
   1.156 +
   1.157 +<p>Please refer to the grammar in <a href="http://www.w3.org/TR/CSS21/grammar.html">appendix D
   1.158 +of the CSS2.1 specification</a> [[!CSS21]] for the definition of the symbols
   1.159 +not defined here.
   1.160 +
   1.161 +<h2 id="interpret">Cascading and Interpretation</h2>
   1.162 +
   1.163 +<p>The declarations in a styling attribute apply to the element to which
   1.164 +the attribute belongs. CSS2.1 <a href="/TR/CSS21/cascade.html#specificity">defines</a>
   1.165 +how style sheets and styling attributes are cascaded together. [[!CSS21]]
   1.166 +Relative URLs in the style data must be resolved relative to the styling
   1.167 +attribute's element (or to the document if per-element resolution is not
   1.168 +defined).
   1.169 +
   1.170 +<p>Aside from the differences in cascading, the declarations in a styling
   1.171 +attribute must be interpreted exactly as if they were given in a CSS
   1.172 +style rule that applies to the element.
   1.173 +
   1.174 +<p>The CSS Working Group strongly recommends that document languages do
   1.175 +not allow multiple CSS styling attributes on a single element. If a document
   1.176 +language allows multiple CSS styling attributes, each must be parsed
   1.177 +independently and treated as a separate style rule, the ordering of which
   1.178 +should be defined by the document language, else is undefined.
   1.179 +
   1.180  <h2 id="ack">Acknowledgments</h2>
   1.181  
   1.182  <p>Thanks to feedback from Daniel Glazman, Ian Hickson, Eric A. Meyer,

mercurial