css-style-attr/Overview.src.html

Fri, 28 Jun 2013 15:50:07 -0700

author
Rebecca Hauck <rhauck@adobe.com>
date
Fri, 28 Jun 2013 15:50:07 -0700
changeset 8599
18bc8956c979
parent 8357
4ce7b66b553a
child 8736
25fb72251985
permissions
-rwxr-xr-x

added/changed links to test suite to land on the suite's cover page

     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 Style Attributes</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   <script defer=defer
    10     src="http://test.csswg.org/harness/annotate.js#CSS-STYLE-ATTR_DEV"
    11     type="text/javascript"></script>
    12 </head>
    14 <div class="head">
    15 <!--logo-->
    17 <h1>CSS Style Attributes</h1>
    19 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
    20 <dl>
    21   <dt>This version:</dt>
    22     <!-- <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> -->
    23     <dd><a href="http://dev.w3.org/csswg/css-style-attr/">http://dev.w3.org/csswg/css-style-attr/</a>
    24     </dd>
    25   <dt>Latest version:
    26     <dd><a href="http://www.w3.org/TR/css-style-attr/">http://www.w3.org/TR/css-style-attr/</a>
    27   <dt>Previous version:
    28     <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>
    29     <dt>Feedback:
    30       <dd><a href="mailto:www-style@w3.org?subject=%5Bcss-style-attr%5D%20feedback">www-style@w3.org</a>
    31           with subject line &ldquo;<kbd>[css-style-attr] <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
    32           (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)
    33   <dt>Editors:
    34     <dd class="vcard"><a lang="tr" class="fn url" href="http://tantek.com/">Tantek &Ccedil;elik</a>
    35 (<span class="company role url">Invited Expert</span>,
    36 formerly <a href="http://www.microsoft.com/">Microsoft Corporation</a>)
    37      &lt;<a class="email"
    38 href="mailto:tantek@cs.stanford.edu">tantek@cs.stanford.edu</a>&gt;
    39     </dd>
    40     <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>)
    41     </dd>
    42   <dt>Previous Editors:
    43     <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;
    44     </dd>
    45     <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;
    46     </dd>
    47     <dt>Test suite:</dt>
    48       <dd>
    49         <a href="http://test.csswg.org/suites/css-style-attr/nightly-unstable/">http://test.csswg.org/suites/css-style-attr/nightly-unstable/</a>
    50       </dd>
    51 </dl>
    52 <!--begin-copyright-->
    53 <p>[Here will be included the file "../copyright.inc"]</p>
    54 <!--end-copyright-->
    56 <hr title="Separator for header">
    57 </div>
    59 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    61 <p>Markup languages such as HTML [[HTML401]] and SVG [[SVG11]] provide a style
    62 attribute on most elements, to hold inline style information that applies
    63 to those elements. One of the possible style sheet languages is CSS. This
    64 draft describes the syntax and interpretation of the CSS fragment that can
    65 be used in such style attributes.
    67 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    68 <!--status-->
    69   <p>For this specification to exit the CR stage, the following conditions
    70    shall be met:
    72   <ol>
    73    <li>
    74     <p>There must be at least two interoperable implementations. For the
    75      purposes of this criterion, we define the following terms:</p>
    77     <dl>
    78      <dt>interoperable
    80      <dd>
    81       <p>passing the respective test case(s) in the <a
    82        href="http://www.w3.org/Style/CSS/Test/">CSS test suite</a>, or, if
    83        the implementation is not a Web browser, an equivalent test. Every
    84        relevant test in the test suite should have an equivalent test created
    85        if such a user agent (UA) is to be used to claim interoperability. In
    86        addition if such a UA is to be used to claim interoperability, then
    87        there must one or more additional UAs which can also pass those
    88        equivalent tests in the same way for the purpose of interoperability.
    89        The equivalent tests must be made publicly available for the purposes
    90        of peer review.</p>
    92      <dt>implementation
    94      <dd>
    95       <p>a user agent which:</p>
    97       <ol>
    98        <li>implements the specification.
   100        <li>is available (i.e. publicly downloadable or available through some
   101         other public point of sale mechanism). This is the "show me"
   102         requirement.
   104        <li>is shipped, or is a "nightly build" (i.e., a development version
   105         for the next release), but is not experimental (i.e., a version
   106         specifically designed to pass the test suite and not intended for
   107         daily usage going forward).
   108       </ol>
   109     </dl>
   111    <li>
   112     <p>A minimum of three months of the CR period must elapse. That
   113      is, this specification will not exit CR before (DATE OF PUBLICATION PLUS THREE MONTHS). When the
   114      specification exits CR, an implementation report will be published. At
   115      this point, no such report exists.</p>
   116   </ol>
   118   <p>A CSS Style Attributes <a href="http://www.w3.org/Style/CSS/Test/">Test
   119    Suite</a> will be developed during the Candidate Recommendation phase of
   120    this CSS Style Attributes specification.
   122 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
   123 <!--toc-->
   125 <h2 id="intro">Introduction</h2>
   127 <p>Some document formats have a <dfn>style attribute</dfn> to permit
   128 the author to directly apply style information to specific elements
   129 in documents. If a document format defines a style attribute (whether named 'style' or something else) and the
   130 attribute accepts CSS as its value, then this specification defines that
   131 <dfn>style attribute</dfn>&rsquo;s syntax and interpretation.
   133 <div class="example">
   134   <p>The following example shows the use of the <code>style</code> attribute
   135   in HTML [[HTML401]]:</p>
   136   <pre>&lt;p style="<em>color: #090; line-height: 1.2</em>"&gt;...&lt;/p&gt;</pre>
   137 </div>
   139 <h2 id="conformance">Conformance</h2>
   141 <p>A document or implementation cannot conform to CSS Style Attributes alone, but can claim conformance to CSS Style Attributes
   142 if it satisfies the conformance requirements in this specification when
   143 implementing CSS together with style attribute handling as defined in a
   144 document language that has one or more CSS style attributes.</p>
   146 <p>Conformance to CSS Style Attributes is defined for two
   147 classes:
   148 <dl>
   149   <dt><dfn>document</dfn></dt>
   150     <dd>A document represented in a document language that defines a style
   151       attribute for one or more of its elements.
   152   <dt><dfn>interpreter</dfn></dt>
   153     <dd>Someone or something that interprets the semantics of a document and
   154       its associated style information.
   155       (Most CSS <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user
   156       agents</a> fall under this category.)</dd>
   157 </dl>
   159 <p>The conformance requirements are expressed with a combination of
   160   descriptive assertions and RFC 2119 terminology. The key words "MUST",
   161   "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
   162   "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
   163   document are to be interpreted as described in RFC 2119.
   164   However, for readability, these words do not appear in all uppercase
   165   letters in this specification. All of the text of this specification is
   166   normative except sections explicitly marked as non-normative, examples,
   167   and notes. [[!RFC2119]]</p>
   169 <p>Examples in this specification are introduced with the words "for example"
   170   or are set apart from the normative text with <code>class="example"</code>,
   171   like this:
   173 <div class="example">
   174   <p>This is an example of an informative example.</p>
   175 </div>
   177 <p>Informative notes begin with the word "Note" and are set apart from the
   178   normative text with <code>class="note"</code>, like this:
   180 <p class="note">Note, this is an informative note.</p>
   182 <h2 id="syntax">Syntax and Parsing</h2>
   184 <p>The value of the style attribute must match the syntax of the contents of
   185 a CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
   186 block</a> (excluding the delimiting braces), whose formal grammar is given
   187 below in the terms and conventions of the
   188 <a href="http://www.w3.org/TR/CSS21/syndata.html#syntax">CSS core grammar</a>:
   190 <pre>
   191 declaration-list
   192   : S* declaration? [ ';' S* declaration? ]*
   193   ;
   194 </pre>
   196 <p class="note">Note that following the CSS2.1 convention, comment tokens
   197 are not shown in the rule above.
   199 <p>The interpreter must parse the style attribute's value using the
   200 same forward-compatible parsing rules that apply to parsing declaration block
   201 contents in a normal CSS style sheet. See
   202 <a href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
   203 specification</a> for details. [[!CSS21]]
   205 <p class="note">Note that because there is no open brace delimiting the
   206 declaration list in the CSS style attribute syntax, a close brace
   207 (<code>}</code>) in the style attribute's value does not terminate the
   208 style data: it is merely an invalid token.</p>
   210 <h2 id="interpret">Cascading and Interpretation</h2>
   212 <p>The declarations in a style attribute apply to the element to which
   213 the attribute belongs. In the cascade, these declarations are considered
   214 to have author origin and a specificity higher than any selector.
   215 CSS2.1 <a href="http://www.w3.org/TR/CSS21/cascade.html#specificity">defines</a>
   216 how style sheets and style attributes are cascaded together. [[!CSS21]]
   217 Relative URLs in the style data must be resolved relative to the style attribute's element (or to the document if per-element resolution is not
   218 defined) when the attribute's value is parsed<!-- so dynamic changes to
   219 the base URL don't affect the CSS ~Hixie -->.
   221 <p>Aside from the differences in cascading, the declarations in a style
   222 attribute must be interpreted exactly as if they were given in a CSS
   223 style rule that applies to the element.
   225 <p>The CSS Working Group strongly recommends that document languages do
   226 not allow multiple CSS style attributes on a single element. If a document
   227 language allows multiple CSS style attributes, each must be parsed
   228 independently and treated as a separate style rule, the ordering of which
   229 should be defined by the document language, else is undefined.
   231 <h2 id="ack">Acknowledgments</h2>
   233 <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>,
   234 <span class="vcard"><span class="fn">Bj&ouml;rn H&ouml;hrmann</span></span>.
   235 </p>
   237 <h2 id="references">References
   239 <h3 class="no-num" id="normative-references">Normative references</h3>
   241 <!--begin-normative-->
   242 <p>[Here will be inserted the file "normative.inc"]</p>
   243 <!--end-normative-->
   245 <h3 class="no-num" id="informative-references">Informative references</h3>
   247 <!--begin-informative-->
   248 <p>[Here will be inserted the file "informative.inc"]</p>
   249 <!--end-informative-->
   251 </body>
   252 </html>
   253 <!-- Keep this comment at the end of the file
   254 Local variables:
   255 mode: sgml
   256 sgml-declaration:"~/SGML/HTML4.decl"
   257 sgml-default-doctype-name:"html"
   258 sgml-minimize-attributes:t
   259 sgml-nofill-elements:("pre" "style" "br")
   260 End:
   261 -->

mercurial