css-style-attr/Overview.src.html

Mon, 13 Sep 2010 21:35:33 +0000

author
Tantek Çelik <tantek@cs.standford.edu>
date
Mon, 13 Sep 2010 21:35:33 +0000
changeset 1958
95fb75eb6487
parent 1953
41226843561b
child 1989
38b148685084
permissions
-rwxr-xr-x

simplify title "CSS Styling Attributes Level 1" to "CSS Style Attributes" to reduce chance of unnecessary developer confusion (why "styling" vs "style"?). Make respective changes in body text. Add parenthetical note that style attribute may be named 'style' or something else.

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

mercurial