css-style-attr/Overview.src.html

Fri, 11 Oct 2013 01:19:13 +0100

author
Simon Sapin <simon.sapin@exyr.org>
date
Fri, 11 Oct 2013 01:19:13 +0100
changeset 9379
3ebe8c1e42cf
parent 9099
abe571678711
child 9380
b7f4434af876
permissions
-rwxr-xr-x

[css-style-attr] Update the Previous Version link.

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

mercurial