Skip to content

Commit c210ad8

Browse files
committed
[css2] Håkon's edits after Nov 2002 ftf.
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401964
1 parent 53fc15e commit c210ad8

3 files changed

Lines changed: 108 additions & 104 deletions

File tree

css2/cascade.src

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: cascade.src,v 2.39 2002-09-17 11:43:36 bbos Exp $ -->
3+
<!-- $Id: cascade.src,v 2.40 2002-11-17 19:35:34 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>
77
</HEAD>
88
<BODY>
9-
<H1>Assigning property values, Cascading, and Inheritance</H1>
109

11-
<H2>Specified, computed, and actual values</h2>
12-
<P>Once a user agent has parsed a document and constructed a <a
10+
<h1>Assigning property values, Cascading, and Inheritance</h1>
11+
12+
<h2>Specified, computed, and actual values</h2>
13+
14+
<p>Once a user agent has parsed a document and constructed a <a
1315
href="conform.html#doctree">document tree</a>, it must assign, for
1416
every element in the tree, a value to every property that applies to the
1517
target <a href="media.html">media type</a>.
1618

17-
<P>The final value of a property is the result of a three-step
19+
<p>The final value of a property is the result of a three-step
1820
calculation: the value is determined through specification (the
1921
"specified value"), then resolved into an absolute value if necessary
2022
(the "computed value"), and finally transformed according to
@@ -24,24 +26,24 @@ the limitations of the local environment (the "actual value").
2426
<span class="index-def" title="specified value">
2527
<a name="specified-value">Specified values</a></span></h3>
2628

27-
<P>User agents must first assign a specified value to a property based
29+
<p>User agents must first assign a specified value to a property based
2830
on the following mechanisms (in order of precedence):</p>
2931

3032
<ol>
3133
<li>If the <a href="#cascade">cascade</a> results in a value,
32-
use it.
34+
use it, unless the resulting value is 'inherit'.
3335

34-
<li>Otherwise, if the property is <a
35-
href="#inheritance">inherited</a>, use the value of the parent
36-
element, generally the computed value.
36+
<li>If the property is <a href="#inheritance">inherited by default</a>
37+
or if the cascade resulted in the value 'inherit', use the computed
38+
value of the parent element.
3739

3840
<li>Otherwise use the property's <span class="index-def"
3941
title="initial value">initial value</span>. The <a
4042
name="initial-value">initial value</a> of each property is indicated
4143
in the property's definition.
4244
</ol>
4345

44-
<P>Since it has no parent, the root of the <a
46+
<p>Since it has no parent, the root of the <a
4547
href="conform.html#doctree">document tree</a> cannot use values from
4648
the parent element; in this case, the initial value is used if
4749
necessary.
@@ -52,7 +54,7 @@ necessary.
5254
</span>
5355
</h3>
5456

55-
<P>Specified values may be absolute (i.e., they are not specified
57+
<p>Specified values may be absolute (i.e., they are not specified
5658
relative to another value, as in 'red' or '2mm') or relative (i.e.,
5759
they are specified relative to another value, as in 'auto', '2em', and
5860
'12%'). For absolute values, no computation is needed to find the
@@ -66,12 +68,6 @@ appropriate font or pixel size, 'auto' values must be computed by the
6668
formulas given with each property, certain keywords ('smaller',
6769
'bolder', 'inherit') must be replaced according to their definitions.
6870

69-
<P>In most cases, elements inherit computed values. However, there are
70-
some properties whose specified value may be inherited (e.g., the
71-
number value for the <span
72-
class="propinst-line-height">'line-height'</span> property).
73-
In the cases where child elements do not inherit the computed value,
74-
this is described in the property definition.
7571

7672
<h3><span class="index-def" title="actual value">
7773
<a name="actual-value">Actual values</a></span></h3>
@@ -83,9 +79,9 @@ pixel widths and may therefore have to approximate the computed
8379
width. The actual value is the computed value after any approximations
8480
have been applied.
8581

86-
<H2><a name="inheritance">Inheritance</a></h2>
82+
<h2><a name="inheritance">Inheritance</a></h2>
8783

88-
<P>Some values are inherited by the children of an element in
84+
<p>Some values are inherited by the children of an element in
8985
the <a href="conform.html#doctree">document tree</a>. Each property <a
9086
href="about.html#property-defs">defines</a> whether it is inherited or
9187
not.
@@ -94,30 +90,20 @@ not.
9490
Suppose there is an H1 element with an emphasizing element (EM)
9591
inside:</p>
9692

97-
<PRE>
93+
<pre>
9894
&lt;H1&gt;The headline &lt;EM&gt;is&lt;/EM&gt; important!&lt;/H1&gt;
99-
</PRE>
95+
</pre>
10096

101-
<P>If no color has been assigned to the EM element, the emphasized
97+
<p>If no color has been assigned to the EM element, the emphasized
10298
"is" will inherit the color of the parent element, so if H1 has the
10399
color blue, the EM element will likewise be in blue.
104100
</div>
105101

106-
<P> To set a "default" style property for a document, authors may set
107-
the property on the root of the document tree. In HTML, for example,
108-
the "html" or "body" elements can serve this function.
109-
110-
<div class="example"><P>
111-
For example, since the <span class="propinst-color">'color'</span>
112-
property is inherited, all descendants of the "body" element will
113-
inherit the color 'black':
114-
115-
<PRE>
116-
body { color: black; }
117-
</PRE>
118-
</div>
119-
120-
<P>Specified percentage values are not inherited; computed values are.
102+
<p>When inheritance occurs, elements inherit computed values. Note
103+
that the result of this inheritance yields the specified value, so
104+
the definitions of computed values for properties do not describe
105+
the computatation of the computed value from a specified 'inherit'
106+
value since 'inherit' cannot be a specified value.
121107

122108
<div class="example"><P>
123109
For example, given the following style sheet:</P>
@@ -150,11 +136,10 @@ of"><a name="value-def-inherit">'inherit'</a></span>
150136
value</h3>
151137

152138
<P>Each property may also have a specified value of 'inherit', which
153-
means that, for a given element, the property takes the same <a
154-
href="#computed-value">computed value</a> as the property for the
155-
element's parent. The inherited value, which is normally only used as
156-
a fallback value, can be strengthened by setting 'inherit' explicitly.
157-
It can also be used on properties that are not normally inherited.
139+
means that, for a given element, the property takes the same computed
140+
value as the property for the element's parent. The 'inherit' value
141+
can be used to stengthen inherited values, and it can also be used on
142+
properties that are not normally inherited.
158143

159144
<div class="example"><P>In the example below, the <span
160145
class="propinst-color">'color'</span> and <span
@@ -235,7 +220,7 @@ document or linked externally.
235220
<li><strong>User</strong>: The user may be able to specify style
236221
information for a particular document. For example, the user may
237222
specify a file that contains a style sheet or the user agent may
238-
provide an interface that generates a user style sheet (or behave as
223+
provide an interface that generates a user style sheet (or behaves as
239224
if it did).
240225

241226
<li><strong>User agent</strong>: <a
@@ -412,7 +397,8 @@ Some examples:
412397
</div>
413398

414399
<div class="html-example"><P>
415-
<PRE>
400+
401+
<pre>
416402
&lt;HEAD&gt;
417403
&lt;STYLE type="text/css"&gt;
418404
#x97z { color: red }
@@ -421,7 +407,7 @@ Some examples:
421407
&lt;BODY&gt;
422408
&lt;P ID=x97z style="color: green"&gt;
423409
&lt;/BODY&gt;
424-
</PRE>
410+
</pre>
425411

426412
<P>In the above example, the color of the P element would be
427413
green. The declaration in the "style" attribute will override the one in
@@ -436,39 +422,54 @@ defined as an "ID" in the source document's DTD.
436422

437423
<H3>Precedence of non-CSS presentational hints</H3>
438424

439-
<p>If the user agent chooses to honor presentational hints from other
440-
sources than style sheets, these hints must be given the same weight
441-
as the user agent's default style sheet.
425+
<P>The UA may choose to honor presentational attributes in the source
426+
document. If so, these attributes are translated to the corresponding
427+
CSS rules with specificity equal to 0, and are treated as if they were
428+
inserted at the start of the author style sheet. They may therefore be
429+
overridden by subsequent style sheet rules. In a transition phase,
430+
this policy will make it easier for stylistic attributes to coexist
431+
with style sheets.
432+
433+
<P>For HTML, any attribute that is not in the following list should be
434+
considered presentational: abbr, accept-charset, accept, accesskey,
435+
action, alt, archive, axis, charset, checked, cite, class, classid,
436+
code, codebase, codetype, colspan, coords, data, datetime, declare,
437+
defer, dir, disabled, enctype, for, headers, href, hreflang,
438+
http-equiv, id, ismap, label, lang, language, longdesc, maxlength,
439+
media, method, multiple, name, nohref, object, onblur, onchange,
440+
onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onload,
441+
onload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup,
442+
onreset, onselect, onsubmit, onunload, onunload, profile, prompt,
443+
readonly, rel, rev, rowspan, scheme, scope, selected, shape, span,
444+
src, standby, start, style, summary, title, type, usemap, value,
445+
valuetype, version.
446+
447+
<P>For XHTML and other languages written in XML, no attribute should
448+
be considered presentational. The styling of elements and
449+
non-presentational attributes should be handled in the user agent
450+
stylesheet.
442451

443-
<div class="note">
444-
<P><em><strong>Note.</strong>
445-
Non-CSS presentational hints had a higher weight in CSS2.</em>
446-
</div>
452+
<div class="example">
447453

448-
<!-- HWL 20020423: replaced description of presentational hints -->
449-
<!--
450-
<P>The UA may choose to honor presentational hints from other sources
451-
than style sheets, for example the FONT element or the ALIGN
452-
attribute in HTML. If so, the non-CSS presentational hints must be
453-
translated to the corresponding CSS rules with specificity equal to
454-
zero. The rules are assumed to be at the start of the author style sheet
455-
and may be overridden by subsequent style sheet rules.
456-
457-
<div class="note">
458-
<P><em><strong>Note.</strong>
459-
In a transition phase, this policy will make it easier for
460-
stylistic attributes to coexist with style sheets.
461-
</em>
462-
</div>
454+
<p>The following user stylesheet would override the font weight of
455+
'b' elements in all documents, and the color of 'font'
456+
elements with color attributes in XML documents. It would not affect
457+
the color of any 'font' elements with color attributes in HTML
458+
documents:
463459

464-
<div class="note">
465-
<P><em><strong>Note.</strong>
466-
In CSS1, the non-CSS presentational hints were given a specificity
467-
equal to 1, not 0. The change is due to the introduction of the
468-
universal selector, which has a specificity of 0.
469-
</em>
460+
<pre>
461+
b { font-weight: normal; }
462+
font[color] { color: orange; }
463+
</pre>
464+
465+
<P>The following, however, would override the color of font elements in all documents:
466+
467+
<pre>
468+
font[color] { color: orange ! important; }
469+
</pre>
470470
</div>
471-
-->
471+
472+
472473

473474
</BODY>
474475
</html>

css2/conform.src

Lines changed: 5 additions & 4 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: conform.src,v 2.52 2002-08-02 17:37:32 bbos Exp $ -->
3+
<!-- $Id: conform.src,v 2.53 2002-11-17 19:33:43 bbos Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>Conformance: requirements and recommendations</TITLE>
@@ -66,7 +66,7 @@ property name, or property value is one that is not valid.
6666
<dt><strong><span class="index-def" title="source document">Source
6767
document</span></strong>
6868

69-
<dd>The document to which one or more style sheets refer. This is
69+
<dd>The document to which one or more style sheets apply. This is
7070
encoded in some language that represents the document as a tree of <a
7171
href="#element">elements</a>. Each element consists of a name that
7272
identifies the type of element, optionally a number of <a
@@ -112,8 +112,9 @@ associated (textual) value.
112112
<dt><strong><span class="index-def" title="content"><a
113113
name="content">Content</a></span></strong>
114114

115-
<dd>The content associated with an element in the source document; not
116-
all elements have content in which case they are called <strong><span
115+
<dd>The content associated with an element in the
116+
source document. Some elements have no content, in which case they are
117+
called <strong><span
117118
class="index-def" title="empty">empty</span></strong>. The content of
118119
an element may include text, and it may include a number of
119120
sub-elements, in which case the element is called the <strong><span

css2/intro.src

Lines changed: 27 additions & 25 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: intro.src,v 2.42 2002-09-17 11:43:37 bbos Exp $ -->
3+
<!-- $Id: intro.src,v 2.43 2002-11-17 19:32:21 bbos Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>Introduction to CSS&nbsp;2.1</TITLE>
@@ -29,22 +29,23 @@ style sheets. For this tutorial, you will need to know a little HTML
2929
&lt;/HTML&gt;
3030
</PRE>
3131

32-
<P>To set the text color of the H1 elements to blue, you can write the
33-
following CSS rule:</P>
32+
<P>To set the text color of the H1 elements to red, you can write the
33+
following CSS rules:</P>
3434

3535
<PRE class="example">
36-
h1 { color: blue }
36+
h1 { color: red }
3737
</PRE>
3838

3939
<P>A CSS rule consists of two main parts: <a
40-
href="selector.html">selector</a> ('h1') and declaration ('color:
41-
blue'). In HTML, element names are case-insensitive so 'h1' works just
42-
as well as 'H1'. The declaration has two parts: property ('color') and
43-
value ('blue'). While the example above tries to influence only one of
44-
the properties needed for rendering an HTML document, it qualifies as
45-
a style sheet on its own. Combined with other style sheets (one
46-
fundamental feature of CSS is that style sheets are combined) it will
47-
determine the final presentation of the document.
40+
href="selector.html">selector</a> ('h1') and declaration
41+
('color:&nbsp;red'). In HTML, element names are case-insensitive so
42+
'h1' works just as well as 'H1'. The declaration has two parts:
43+
property ('color') and value ('red'). While the example above tries to
44+
influence only one of the properties needed for rendering an HTML
45+
document, it qualifies as a style sheet on its own. Combined with
46+
other style sheets (one fundamental feature of CSS is that style
47+
sheets are combined) it will determine the final presentation of the
48+
document.
4849

4950
<P> The HTML 4.0 specification defines how style sheet rules may be
5051
specified for HTML documents: either within the HTML document, or via
@@ -57,7 +58,7 @@ the STYLE element:</p>
5758
&lt;HEAD&gt;
5859
&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;
5960
&lt;STYLE type="text/css"&gt;
60-
h1 { color: blue }
61+
h1 { color: red }
6162
&lt;/STYLE&gt;
6263
&lt;/HEAD&gt;
6364
&lt;BODY&gt;
@@ -105,8 +106,8 @@ tutorial. Let's add more colors:
105106
&lt;HEAD&gt;
106107
&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;
107108
&lt;STYLE type="text/css"&gt;
108-
body { color: red }
109-
h1 { color: blue }
109+
body { color: black; background: white }
110+
h1 { color: red; background: white }
110111
&lt;/STYLE&gt;
111112
&lt;/HEAD&gt;
112113
&lt;BODY&gt;
@@ -116,16 +117,17 @@ tutorial. Let's add more colors:
116117
&lt;/HTML&gt;
117118
</PRE>
118119

119-
<P>The style sheet now contains two rules: the first one sets the
120-
color of the BODY element to 'red', while the second one sets the
121-
color of the H1 element to 'blue'. Since no color value has been
122-
specified for the P element, it will inherit the color from its parent
123-
element, namely BODY. The H1 element is also a child element of BODY
124-
but the second rule overrides the inherited value. In CSS there are
125-
often such conflicts between different values, and this specification
126-
describes how to resolve them.
127-
128-
<P>CSS&nbsp;2.1 has more than 90 different properties, including <span
120+
<P>The style sheet now contains four rules: the first two set the
121+
color and background of the BODY element (it's a good idea to set the
122+
text color and background color together), while the last two
123+
set the color and the background of the H1 element. Since no color
124+
has been specified for the P element, it will inherit the color
125+
from its parent element, namely BODY. The H1 element is also a child
126+
element of BODY but the second rule overrides the inherited value. In
127+
CSS there are often such conflicts between different values, and this
128+
specification describes how to resolve them.
129+
130+
<P>CSS&nbsp;2.1 has more than 90 properties, including <span
129131
class="propinst-color">'color'</span>. Let's look at some of the
130132
others:
131133

0 commit comments

Comments
 (0)