css-style-attr/Overview.src.html

Thu, 07 Jan 2010 08:54:32 +0000

author
Elika Etemad <fantasai.cvs@inkedblade.net>
date
Thu, 07 Jan 2010 08:54:32 +0000
changeset 1612
750d888b5712
parent 1611
f7c26d1266f9
child 1616
cfd6911cf9c6
permissions
-rwxr-xr-x

More precise wording on URL resolution

     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 Attribute Syntax 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 Attribute Syntax 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   <dt>Latest version:
    22     <dd><a href="http://www.w3.org/TR/css-style-attr">http://www.w3.org/TR/css-style-attr</a>
    23   <dt>Previous version:
    24     <dd><a href="http://www.w3.org/TR/2002/WD-css-style-attr-20020515">http://www.w3.org/TR/2002/WD-css-style-attr-20020515</a>
    25   <dt>Editor:
    26     <dd><a href="http://fantasai.inkedblade.net/contact/">Elika J. Etemad</a>
    27   <dt>Previous Editors:
    28   <dd><span lang="tr">Tantek &Ccedil;elik</span> (<a href="http://www.microsoft.com/">Microsoft</a>), &lt;<a href="mailto:tantekc@microsoft.com">tantekc@microsoft.com</a>&gt;
    29   <dd><a href="http://www.w3.org/People/Bos/">Bert Bos</a> (<a href="http://www.w3.org/">W3C</a>), &lt;<a href="mailto:bert@w3.org">bert@w3.org</a>&gt;
    30   <dd>Marc Attinasi (AOL/Netscape), &lt;<a href="mailto:attinasi@netscape.com">attinasi@netscape.com</a>&gt;
    31 </dl>
    32 <!--begin-copyright-->
    33 <p>[Here will be included the file "../copyright.inc"]</p>
    34 <!--end-copyright-->
    36 <hr title="Separator for header">
    37 </div>
    39 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    41 <p>Markup languages such as HTML and SVG provide a styling attribute on most
    42 elements, to hold a fragment of a style sheet that applies to those elements.
    43 One of the possible style sheet languages is CSS. This draft describes the
    44 syntax of the CSS fragment that can be used in the styling attribute.
    46 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    47 <!--status-->
    49 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
    50 <!--toc-->
    52 <h2 id="intro">Introduction</h2>
    54 <p>Some document formats have a <dfn>styling attribute</dfn> to permit
    55 the author to directly apply style information to specific elements
    56 in documents. If a document format defines a styling attribute and the
    57 attribute accepts CSS as its value, then this specification defines this
    58 <dfn>CSS styling attribute</dfn>'s syntax and interpretation.
    60 <div class="example">
    61   <p>The following example shows the use of the <code>style</code> attribute
    62   in HTML:</p>
    63   <pre>&lt;p style="<em>color: #090; line-height: 1.2</em>"&gt;...&lt;/p&gt;</pre>
    64 </div>
    66 <h2 id="conformance">Conformance</h2>
    68 <p>A document or implementation cannot conform to CSS Styling Attribute Syntax
    69 Level 1 alone, but can claim conformance to CSS Styling Attribute Syntax Level 1
    70 if it satisfies the conformance requirements in this specification when
    71 implementing CSS together with styling attribute handling as defined in a
    72 document language that has CSS styling attributes.</p>
    74 <p>Conformance to CSS Styling Attribute Syntax Level 1 is defined for two
    75 classes:
    76 <dl>
    77   <dt><dfn>document</dfn></dt>
    78     <dd>A document represented in a document language that defines a styling
    79       attribute for one or more of its elements.
    80   <dt><dfn>interpreter</dfn></dt>
    81     <dd>Someone or something that interprets the semantics of a document and
    82       its associated style information.
    83       (Most CSS <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user
    84       agents</a> fall under this category.)</dd>
    85 </dl>
    87 <p>The conformance requirements are expressed with a combination of
    88   descriptive assertions and RFC 2119 terminology. The key words "MUST",
    89   "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
    90   "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
    91   document are to be interpreted as described in RFC 2119.
    92   However, for readability, these words do not appear in all uppercase
    93   letters in this specification. All of the text of this specification is
    94   normative except sections explicitly marked as non-normative, examples,
    95   and notes. [[!RFC2119]]</p>
    97 <p>Examples in this specification are introduced with the words "for example"
    98   or are set apart from the normative text with <code>class="example"</code>,
    99   like this:
   101 <div class="example">
   102   <p>This is an example of an informative example.</p>
   103 </div>
   105 <p>Informative notes begin with the word "Note" and are set apart from the
   106   normative text with <code>class="note"</code>, like this:
   108 <p class="note">Note, this is an informative note.</p>
   110 <h2 id="syntax">Syntax and Parsing</h2>
   112 <p>The value of the styling attribute must match the syntax of the contents of
   113 a CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
   114 block</a>. The interpreter must parse the styling attribute's value using the
   115 same forward-compatible parsing rules that apply to parsing declaration block
   116 contents in a normal CSS style sheet. See
   117 <a href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
   118 specification</a>. [[!CSS21]]
   120 <p class="note">Note that because there is no open brace delimiting the
   121 declaration list in the CSS styling attribute syntax, a close brace
   122 (<code>}</code>) in the styling attribute's value does not terminate the
   123 style data: it is merely an invalid token.</p>
   125 <h2 id="grammar">Grammar</h2>
   127 <p>The syntax of the CSS fragment that is allowed as the CSS styling
   128 attribute's value is formally specified as follows:
   130 <pre>
   131 inline-stylesheet
   132   : S* declaration-list
   133   ;
   135 declaration-list
   136   : declaration [ ';' S* declaration ]*
   137   ;
   138 </pre>
   140 <p>Please refer to the grammar in <a href="http://www.w3.org/TR/CSS21/grammar.html">appendix D
   141 of the CSS2.1 specification</a> [[!CSS21]] for the definition of the symbols
   142 not defined here.
   144 <h2 id="interpret">Cascading and Interpretation</h2>
   146 <p>The declarations in a styling attribute apply to the element to which
   147 the attribute belongs. CSS2.1 <a href="/TR/CSS21/cascade.html#specificity">defines</a>
   148 how style sheets and styling attributes are cascaded together. [[!CSS21]]
   149 Relative URLs in the style data must be resolved relative to the styling
   150 attribute's element (or to the document if per-element resolution is not
   151 defined) when the attribute's value is parsed<!-- so dynamic changes to
   152 the base URL don't affect the CSS ~Hixie -->.
   154 <p>Aside from the differences in cascading, the declarations in a styling
   155 attribute must be interpreted exactly as if they were given in a CSS
   156 style rule that applies to the element.
   158 <p>The CSS Working Group strongly recommends that document languages do
   159 not allow multiple CSS styling attributes on a single element. If a document
   160 language allows multiple CSS styling attributes, each must be parsed
   161 independently and treated as a separate style rule, the ordering of which
   162 should be defined by the document language, else is undefined.
   164 <h2 id="ack">Acknowledgments</h2>
   166 <p>Thanks to feedback from Daniel Glazman, Ian Hickson, Eric A. Meyer,
   167 Bj&ouml;rn H&ouml;hrmann.
   169 <h2 id="references">References
   171 <h3 class="no-num" id="normative-references">Normative references</h3>
   173 <!--begin-normative-->
   174 <p>[Here will be inserted the file "normative.inc"]</p>
   175 <!--end-normative-->
   177 <h3 class="no-num" id="informative-references">Informative references</h3>
   179 <!--begin-informative-->
   180 <p>[Here will be inserted the file "informative.inc"]</p>
   181 <!--end-informative-->
   183 </body>
   184 </html>
   185 <!-- Keep this comment at the end of the file
   186 Local variables:
   187 mode: sgml
   188 sgml-declaration:"~/SGML/HTML4.decl"
   189 sgml-default-doctype-name:"html"
   190 sgml-minimize-attributes:t
   191 sgml-nofill-elements:("pre" "style" "br")
   192 End:
   193 -->

mercurial