Skip to content

Commit 7172199

Browse files
committed
[css2] Changes by Håkon: lowercased CSS examples.
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401882
1 parent 8787799 commit 7172199

8 files changed

Lines changed: 463 additions & 498 deletions

File tree

css2/cascade.src

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: cascade.src,v 2.34 2002-04-23 20:17:51 bbos Exp $ -->
3+
<!-- $Id: cascade.src,v 2.35 2002-07-05 13:21:27 bbos Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>Assigning property values, Cascading, and Inheritance</TITLE>
@@ -91,31 +91,29 @@ href="about.html#property-defs">defines</a> whether it is inherited or
9191
not.
9292

9393
<div class="html-example"><P>
94-
Suppose there is an H1 element with an emphasizing element (EM)
94+
Suppose there is an "h1" element with an emphasizing element ("em")
9595
inside:</p>
9696

9797
<PRE>
98-
&lt;H1&gt;The headline &lt;EM&gt;is&lt;/EM&gt; important!&lt;/H1&gt;
98+
&lt;h1&gt;The headline &lt;em&gt;is&lt;/em&gt; important!&lt;/h1&gt;
9999
</PRE>
100100

101-
<P>If no color has been assigned to the EM element, the emphasized
102-
"is" will inherit the color of the parent element, so if H1 has the
101+
<P>If no color has been assigned to the "em" element, the emphasized
102+
"is" will inherit the color of the parent element, so if "h1" has the
103103
color blue, the EM element will likewise be in blue.
104104
</div>
105105

106106
<P> To set a "default" style property for a document, authors may set
107107
the property on the root of the document tree. In HTML, for example,
108-
the HTML or BODY elements can serve this function. Note that this will
109-
work even if the author omits the BODY tag in the HTML source since
110-
the HTML parser will infer the missing tag.
108+
the "html" or "body" elements can serve this function.
111109

112110
<div class="example"><P>
113111
For example, since the <span class="propinst-color">'color'</span>
114-
property is inherited, all descendants of the BODY element will
112+
property is inherited, all descendants of the "body" element will
115113
inherit the color 'black':
116114

117115
<PRE>
118-
BODY { color: black; }
116+
body { color: black; }
119117
</PRE>
120118
</div>
121119

@@ -125,26 +123,26 @@ BODY { color: black; }
125123
For example, given the following style sheet:</P>
126124

127125
<pre>
128-
BODY { font-size: 10pt }
129-
H1 { font-size: 120% }
126+
body { font-size: 10pt }
127+
h1 { font-size: 120% }
130128
</pre>
131129

132130
<p>and this document fragment:
133131

134132
<pre class="html-example">
135-
&lt;BODY&gt;
136-
&lt;H1&gt;A &lt;EM&gt;large&lt;/EM&gt; heading&lt;/H1&gt;
137-
&lt;/BODY&gt;
133+
&lt;body&gt;
134+
&lt;h1&gt;A &lt;em&gt;large&lt;/em&gt; heading&lt;/h1&gt;
135+
&lt;/body&gt;
138136
</pre>
139137

140138
<p>the <span class="prop-inst-font-size">'font-size'</span> property
141-
for the H1 element will have the computed value '12pt' (120% times
139+
for the "h1" element will have the computed value '12pt' (120% times
142140
10pt, the parent's value). Since the computed value of <span
143-
class="propinst-font-size">'font-size'</span> is inherited, the EM
141+
class="propinst-font-size">'font-size'</span> is inherited, the "em"
144142
element will have the computed value '12pt' as well. If the
145143
user agent does not have the 12pt font available, the
146144
actual value of <span class="propinst-font-size">'font-size'</span>
147-
for both H1 and EM might be, for example, '11pt'.
145+
for both "h1" and "em" might be, for example, '11pt'.
148146
</div>
149147

150148
<h3>The <span class="index-def" title="inherit, definition
@@ -167,7 +165,7 @@ part of the user's style sheet, black text on a white background will
167165
be enforced throughout the document.
168166

169167
<PRE>
170-
BODY {
168+
body {
171169
color: black !important;
172170
background: white !important;
173171
}
@@ -212,9 +210,7 @@ title="conditional import|media-dependent import">conditional
212210
imports</span> specify comma-separated media types after the URI.
213211

214212
<div class="example">
215-
<p>The following rules have the same effect as if the imported style
216-
sheet were wrapped in an @media rule for the same media, but it may
217-
save the UA a fruitless download.
213+
<p>The following rules illustrate how @import rules can be made media-dependent:</p>
218214

219215
<pre>
220216
@import url("fineprint.css") print;
@@ -250,9 +246,9 @@ name="default-style-sheet"><dfn>default style sheet</dfn></a></span>
250246
document. A user agent's default style sheet should present the
251247
elements of the document language in ways that satisfy general
252248
presentation expectations for the document language (e.g., for visual
253-
browsers, the EM element in HTML is presented using an italic
254-
font). See <a href="sample.html">"A sample style sheet for HTML
255-
4.0"</a> for a recommended default style sheet for HTML 4.0 documents.
249+
browsers, the "em" element in HTML is presented using an italic
250+
font). See <a href="sample.html">A sample style sheet for HTML
251+
</a> for a recommended default style sheet for HTML documents.
256252

257253
<P>Note that the default style sheet may change if system settings are
258254
modified by the user (e.g., system colors). However, due to
@@ -290,9 +286,7 @@ must apply the following sorting order:</p>
290286
Declarations apply if the associated selector <A
291287
HREF="selector.html">matches</A> the element in question.
292288

293-
<!-- HWL 20020423: editorial change to description of weight/origin -->
294-
295-
<LI>The primary sort of the declarations is by weight (normal or important) and origin (author, user, or user agent). The weight of style sheets, in ascending order, is:
289+
<LI>The primary sorting criteria for declarations is weight (normal or important) and origin (author, user, or user agent). The weight of style sheets, in ascending order, is:
296290

297291
<ol>
298292
<li>user agent style sheets
@@ -303,7 +297,7 @@ must apply the following sorting order:</p>
303297
</ol>
304298

305299
<LI>
306-
The secondary sort is by <a href="#specificity">specificity</a>
300+
The secondary sorting criteria is <a href="#specificity">specificity</a>
307301
of selector: more specific
308302
selectors will override more general ones. Pseudo-elements and
309303
pseudo-classes are counted as normal elements and classes,
@@ -354,7 +348,7 @@ equivalent to declaring all of its sub-properties to be "!important".
354348

355349
<div class="example">
356350

357-
<P> The first rule in the user's style sheet in the following example
351+
<P>The first rule in the user's style sheet in the following example
358352
contains an "!important" declaration, which overrides the corresponding
359353
declaration in the author's style sheet. The second declaration
360354
will also win due to being marked "!important". However, the third
@@ -367,14 +361,14 @@ function also within author style sheets.
367361

368362
<PRE>
369363
/* From the user's style sheet */
370-
P { text-indent: 1em ! important }
371-
P { font-style: italic ! important }
372-
P { font-size: 18pt }
364+
p { text-indent: 1em ! important }
365+
p { font-style: italic ! important }
366+
p { font-size: 18pt }
373367

374368
/* From the author's style sheet */
375-
P { text-indent: 1.5em !important }
376-
P { font: 12pt sans-serif !important }
377-
P { font-size: 24pt }
369+
p { text-indent: 1.5em !important }
370+
p { font: 12pt sans-serif !important }
371+
p { font-size: 24pt }
378372
</PRE>
379373
</div>
380374

@@ -383,14 +377,19 @@ P { font-size: 24pt }
383377
<P>A selector's specificity is calculated as follows:</p>
384378

385379
<ul>
380+
386381
<li>count 1 if the selector is a 'style' attribute rather than a
387382
selector, 0 otherwise (= a) (In HTML, values of an element's "style"
388383
attribute are style sheet rules. These rules have no selectors, so
389384
a=1, b=0, c=0, and d=0.)
385+
390386
<li>count the number of ID attributes in the selector (= b)
387+
391388
<li>count the number of other attributes and pseudo-classes
392389
in the selector (= c)
390+
393391
<li>count the number of element names in the selector (= d)
392+
394393
<li>ignore pseudo-elements.
395394
</ul>
396395

@@ -402,32 +401,32 @@ Some examples:
402401

403402
<PRE>
404403
* {} /* a=0 b=0 c=0 d=0 -&gt; specificity = 0,0,0,0 */
405-
LI {} /* a=0 b=0 c=0 d=1 -&gt; specificity = 0,0,0,1 */
406-
UL LI {} /* a=0 b=0 c=0 d=2 -&gt; specificity = 0,0,0,2 */
407-
UL OL+LI {} /* a=0 b=0 c=0 d=3 -&gt; specificity = 0,0,0,3 */
408-
H1 + *[REL=up]{} /* a=0 b=0 c=1 d=1 -&gt; specificity = 0,0,1,1 */
409-
UL OL LI.red {} /* a=0 b=0 c=1 d=3 -&gt; specificity = 0,0,1,3 */
410-
LI.red.level {} /* a=0 b=0 c=2 d=1 -&gt; specificity = 0,0,2,1 */
404+
li {} /* a=0 b=0 c=0 d=1 -&gt; specificity = 0,0,0,1 */
405+
ul li {} /* a=0 b=0 c=0 d=2 -&gt; specificity = 0,0,0,2 */
406+
ul ol+li {} /* a=0 b=0 c=0 d=3 -&gt; specificity = 0,0,0,3 */
407+
h1 + *[rel=up]{} /* a=0 b=0 c=1 d=1 -&gt; specificity = 0,0,1,1 */
408+
ul ol li.red {} /* a=0 b=0 c=1 d=3 -&gt; specificity = 0,0,1,3 */
409+
li.red.level {} /* a=0 b=0 c=2 d=1 -&gt; specificity = 0,0,2,1 */
411410
#x34y {} /* a=0 b=1 c=0 d=0 -&gt; specificity = 0,1,0,0 */
412411
style="" /* a=1 b=0 c=0 d=0 -&gt; specificity = 1,0,0,0 */
413412
</PRE>
414413
</div>
415414

416415
<div class="html-example"><P>
417416
<PRE>
418-
&lt;HEAD&gt;
419-
&lt;STYLE type="text/css"&gt;
417+
&lt;head&gt;
418+
&lt;style type="text/css"&gt;
420419
#x97z { color: red }
421-
&lt;/STYLE&gt;
422-
&lt;/HEAD&gt;
423-
&lt;BODY&gt;
424-
&lt;P ID=x97z style="color: green"&gt;
425-
&lt;/BODY&gt;
420+
&lt;/style&gt;
421+
&lt;/head&gt;
422+
&lt;body&gt;
423+
&lt;p ID=x97z style="color: green"&gt;
424+
&lt;/body&gt;
426425
</PRE>
427426

428-
<P>In the above example, the color of the P element would be
427+
<P>In the above example, the color of the "p" element would be
429428
green. The declaration in the "style" attribute will override the one in
430-
the STYLE element because of cascading rule 3, since it has a higher
429+
the "style" element because of cascading rule 3, since it has a higher
431430
specificity.
432431
</div>
433432

@@ -436,7 +435,6 @@ particular, a selector of the form "[id=p33]" is counted as an
436435
attribute selector (a=0, b=0, c=1, d=0), even if the id attribute is
437436
defined as an "ID" in the source document's DTD.
438437

439-
440438
<H3>Precedence of non-CSS presentational hints</H3>
441439

442440
<p>If the user agent chooses to honor presentational hints from other

0 commit comments

Comments
 (0)