css-style-attr/Overview.src.html

Tue, 24 Aug 2010 11:11:17 +0000

author
Elika Etemad <fantasai.cvs@inkedblade.net>
date
Tue, 24 Aug 2010 11:11:17 +0000
changeset 1915
ca4cd8044f3f
parent 1912
197c9052da1e
child 1953
41226843561b
permissions
-rwxr-xr-x

Clarify that declaration block contents doesn't include declaration block delimiters

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
     2 <html lang="en">
     3 <head>
     4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     5   <title>CSS Styling Attributes Level 1</title>
     6   <link rel="stylesheet" type="text/css" href="default.css">
     8   <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED">
     9 </head>
    11 <div class="head">
    12 <!--logo-->
    14 <h1>CSS Styling Attributes Level 1</h1>
    16 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
    17 <dl>
    18   <dt>This version:</dt>
    19     <!-- <dd><dd><a href="http://www.w3.org/TR/[YEAR]/WD-css-style-attr-[CDATE]/">http://www.w3.org/TR/[YEAR]/WD-css-style-attr-[CDATE]/</a></dd> -->
    20     <dd><a href="http://dev.w3.org/csswg/css-style-attr/">http://dev.w3.org/csswg/css-style-attr/</a>
    21     </dd>
    22   <dt>Latest version:
    23     <dd><a href="http://www.w3.org/TR/css-style-attr">http://www.w3.org/TR/css-style-attr</a>
    24   <dt>Previous version:
    25     <dd><a href="http://www.w3.org/TR/2010/WD-css-style-attr-20100121/">http://www.w3.org/TR/2010/WD-css-style-attr-20100121/</a>
    26   <dt>Editors:
    27     <dd class="vcard"><a lang="tr" class="fn url" href="http://tantek.com/">Tantek &Ccedil;elik</a>
    28 (<span class="company role url">invited expert</span>,
    29 and before at <a href="http://www.microsoft.com/">Microsoft Corporation</a>)
    30      &lt;<a class="email"
    31 href="mailto:tantek@cs.stanford.edu">tantek@cs.stanford.edu</a>&gt;
    32     </dd>
    33     <dd class="vcard"><a class="fn n url" href="http://fantasai.inkedblade.net/contact"><span class="given-name">Elika</span> <abbr class="additional-name">J.</abbr> <span class="family-name">Etemad</span></a> (<span class="company role">invited expert</span>)
    34     </dd>
    35   <dt>Previous Editors:
    36     <dd class="vcard"><a class="fn url" href="http://www.w3.org/People/Bos/">Bert Bos</a> (<a class="org" href="http://www.w3.org/">W3C</a>), &lt;<a class="email" href="mailto:bert@w3.org">bert@w3.org</a>&gt;
    37     </dd>
    38     <dd class="vcard"><span class="fn">Marc Attinasi</span> (<span class="org">AOL/Netscape</span>), &lt;<a class="email" href="mailto:attinasi@netscape.com">attinasi@netscape.com</a>&gt;
    39     </dd>
    40 </dl>
    41 <!--begin-copyright-->
    42 <p>[Here will be included the file "../copyright.inc"]</p>
    43 <!--end-copyright-->
    45 <hr title="Separator for header">
    46 </div>
    48 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    50 <p>Markup languages such as HTML [[HTML401]] and SVG [[SVG11]] provide a styling
    51 attribute on most elements, to hold inline style information that applies
    52 to those elements. One of the possible style sheet languages is CSS. This
    53 draft describes the syntax and interpretation of the CSS fragment that can
    54 be used in such styling attributes.
    56 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    57 <!--status-->
    58   <p>This specification is a <strong>Last Call Working Draft</strong>. All
    59    persons are encouraged to review this document and <strong>send comments
    60    to the <a
    61    href="http://lists.w3.org/Archives/Public/www-style/">www-style</a>
    62    mailing list</strong> as described above. The <strong>deadline for
    63    comments</strong> is <strong>9 February 2010</strong>.
    65   <p>A CSS Styling Attribute <a href="http://www.w3.org/Style/CSS/Test/">Test
    66    Suite</a> will be developed during the Candidate Recommendation phase of
    67    this CSS Styling Attribute specification.
    69 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
    70 <!--toc-->
    72 <h2 id="intro">Introduction</h2>
    74 <p>Some document formats have a <dfn>styling attribute</dfn> to permit
    75 the author to directly apply style information to specific elements
    76 in documents. If a document format defines a styling attribute and the
    77 attribute accepts CSS as its value, then this specification defines that
    78 <dfn>CSS styling attribute</dfn>&rsquo;s syntax and interpretation.
    80 <div class="example">
    81   <p>The following example shows the use of the <code>style</code> attribute
    82   in HTML [[HTML401]]:</p>
    83   <pre>&lt;p style="<em>color: #090; line-height: 1.2</em>"&gt;...&lt;/p&gt;</pre>
    84 </div>
    86 <h2 id="conformance">Conformance</h2>
    88 <p>A document or implementation cannot conform to CSS Styling Attributes
    89 Level 1 alone, but can claim conformance to CSS Styling Attributes Level 1
    90 if it satisfies the conformance requirements in this specification when
    91 implementing CSS together with styling attribute handling as defined in a
    92 document language that has CSS styling attributes.</p>
    94 <p>Conformance to CSS Styling Attributes Level 1 is defined for two
    95 classes:
    96 <dl>
    97   <dt><dfn>document</dfn></dt>
    98     <dd>A document represented in a document language that defines a styling
    99       attribute for one or more of its elements.
   100   <dt><dfn>interpreter</dfn></dt>
   101     <dd>Someone or something that interprets the semantics of a document and
   102       its associated style information.
   103       (Most CSS <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user
   104       agents</a> fall under this category.)</dd>
   105 </dl>
   107 <p>The conformance requirements are expressed with a combination of
   108   descriptive assertions and RFC 2119 terminology. The key words "MUST",
   109   "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
   110   "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
   111   document are to be interpreted as described in RFC 2119.
   112   However, for readability, these words do not appear in all uppercase
   113   letters in this specification. All of the text of this specification is
   114   normative except sections explicitly marked as non-normative, examples,
   115   and notes. [[!RFC2119]]</p>
   117 <p>Examples in this specification are introduced with the words "for example"
   118   or are set apart from the normative text with <code>class="example"</code>,
   119   like this:
   121 <div class="example">
   122   <p>This is an example of an informative example.</p>
   123 </div>
   125 <p>Informative notes begin with the word "Note" and are set apart from the
   126   normative text with <code>class="note"</code>, like this:
   128 <p class="note">Note, this is an informative note.</p>
   130 <h2 id="syntax">Syntax and Parsing</h2>
   132 <p>The value of the styling attribute must match the syntax of the contents of
   133 a CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
   134 block</a> (excluding the delimiting braces), whose formal grammar is given
   135 below in the terms and conventions of the
   136 <a href="http://www.w3.org/TR/CSS21/syndata.html#syntax">CSS core grammar</a>:
   138 <pre>
   139 declaration-list
   140   : S* declaration? [ ';' S* declaration? ]*
   141   ;
   142 </pre>
   144 <p class="note">Note that following the CSS2.1 convention, comment tokens
   145 are not shown in the rule above.
   147 <p>The interpreter must parse the styling attribute's value using the
   148 same forward-compatible parsing rules that apply to parsing declaration block
   149 contents in a normal CSS style sheet. See
   150 <a href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
   151 specification</a> for details. [[!CSS21]]
   153 <p class="note">Note that because there is no open brace delimiting the
   154 declaration list in the CSS styling attribute syntax, a close brace
   155 (<code>}</code>) in the styling attribute's value does not terminate the
   156 style data: it is merely an invalid token.</p>
   158 <h2 id="interpret">Cascading and Interpretation</h2>
   160 <p>The declarations in a styling attribute apply to the element to which
   161 the attribute belongs. In the cascade, these declarations are considered
   162 to have author origin and a specificity higher than any selector.
   163 CSS2.1 <a href="http://www.w3.org/TR/CSS21/cascade.html#specificity">defines</a>
   164 how style sheets and styling attributes are cascaded together. [[!CSS21]]
   165 Relative URLs in the style data must be resolved relative to the styling
   166 attribute's element (or to the document if per-element resolution is not
   167 defined) when the attribute's value is parsed<!-- so dynamic changes to
   168 the base URL don't affect the CSS ~Hixie -->.
   170 <p>Aside from the differences in cascading, the declarations in a styling
   171 attribute must be interpreted exactly as if they were given in a CSS
   172 style rule that applies to the element.
   174 <p>The CSS Working Group strongly recommends that document languages do
   175 not allow multiple CSS styling attributes on a single element. If a document
   176 language allows multiple CSS styling attributes, each must be parsed
   177 independently and treated as a separate style rule, the ordering of which
   178 should be defined by the document language, else is undefined.
   180 <h2 id="ack">Acknowledgments</h2>
   182 <p>Thanks to feedback from <span class="vcard"><span class="fn">Daniel Glazman</span></span>, <span class="vcard"><span class="fn">Ian Hickson</span></span>, <span class="vcard"><span class="fn n"><span class="given-name">Eric</span> <abbr class="additional-name">A.</abbr> <span class="family-name">Meyer</span></span></span>,
   183 <span class="vcard"><span class="fn">Bj&ouml;rn H&ouml;hrmann</span></span>.
   184 </p>
   186 <h2 id="references">References
   188 <h3 class="no-num" id="normative-references">Normative references</h3>
   190 <!--begin-normative-->
   191 <p>[Here will be inserted the file "normative.inc"]</p>
   192 <!--end-normative-->
   194 <h3 class="no-num" id="informative-references">Informative references</h3>
   196 <!--begin-informative-->
   197 <p>[Here will be inserted the file "informative.inc"]</p>
   198 <!--end-informative-->
   200 </body>
   201 </html>
   202 <!-- Keep this comment at the end of the file
   203 Local variables:
   204 mode: sgml
   205 sgml-declaration:"~/SGML/HTML4.decl"
   206 sgml-default-doctype-name:"html"
   207 sgml-minimize-attributes:t
   208 sgml-nofill-elements:("pre" "style" "br")
   209 End:
   210 -->

mercurial