Skip to content

Commit fafdbae

Browse files
committed
[css2] Edits based on Hakons extensive comments + Chris/Bert replies
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%40977
1 parent 365f566 commit fafdbae

1 file changed

Lines changed: 67 additions & 64 deletions

File tree

css2/cascade.src

Lines changed: 67 additions & 64 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.1 1998-02-18 11:45:31 howcome Exp $ -->
3+
<!-- $Id: cascade.src,v 2.2 1998-02-18 23:37:40 ijacobs 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>
@@ -18,18 +18,19 @@ target <a href="media.html">media type</a>.
1818
calculation: the value is determined through specification (the
1919
"specified value"), then resolved into an absolute value if necessary
2020
(the "computed value"), and finally transformed according to
21-
the limitations of the local environment (the "actual value") if
22-
necessary.
21+
the limitations of the local environment (the "actual value").
2322

24-
<h3><a name="specified-value">Specified values</a></h3>
23+
<h3>
24+
<span class="index-def" title="specified value">
25+
<a name="specified-value">Specified values</a></span></h3>
2526

26-
<P>User agents must first assign a <span class="index-def"
27-
title="specified value">specified value</span> to a property
28-
based on the following mechanisms (in order of precedence):</p>
27+
<P>User agents must first assign a specified value to a property based
28+
on the following mechanisms (in order of precedence):</p>
2929

3030
<ol>
3131
<li>If the <a href="#cascade">cascade</a> results in a value,
32-
use it.
32+
use it. If the value is 'inherit', use the value of the parent
33+
element.
3334

3435
<li>Otherwise, if the value is <a href="#inheritance">inherited</a>,
3536
use it.
@@ -40,56 +41,55 @@ name="initial-value">initial value</a> of each property is indicated
4041
in the property's definition.
4142
</ol>
4243

43-
<h3><a name="computed-value">Computed values</a></h3>
44-
45-
<P>Specified values may be "absolute" (e.g., the color value 'red' or
46-
the constant value 'hidden') or "relative" (e.g., the variable value
47-
'auto', the font-related value '1.2em', pixel values, percentage values,
48-
etc.). Each value must be transformed into a <span class="index-def"
49-
title="computed value">computed value</span> according to
50-
algorithms described in this specification.
44+
<P>The root of the <a href="conform.html#doctree">document tree</a>
45+
cannot use values from the parent element since it has no parent. As a
46+
substitute, the initial value should be used whenever the root element
47+
needs a value from a parent element.
5148

52-
<P>When the root of the document tree has a property whose specified
53-
value is inherited and has relative units, the computed value is the
54-
percentage times the property's initial value.
49+
<h3><span class="index-def" title="computed value">
50+
<a name="computed-value">Computed values</a>
51+
</span>
52+
</h3>
5553

56-
<div class="example"><P>
57-
For example, with an HTML document and the following style sheet:
58-
<pre>
59-
HTML { font-size: 120% }
60-
</pre>
54+
<P>Specified values may be absolute (i.e., they are not specified
55+
relative to another value, as in 'red' or '2mm') or relative (i.e.,
56+
they are specified relative to another value, as in 'auto', '2em', and
57+
'12%'). For absolute values, no computation is needed to find the
58+
computed value. Relative values, on the other hand, must be
59+
transformed into computed <a href="syndata.html#values">values</a>
60+
as described in the chapter on <a href="syndata.html">syntax</a>.
61+
Each property defines the meaning of that property's percentage
62+
values.
6163

62-
<p>the computed value for <span
63-
class="prop-inst-font-size">'font-size'</span> will be 120% of the
64-
initial value of the <span
65-
class="propinst-font-size">'font-size'</span> property. The initial
66-
value of <span class="propinst-font-size">'font-size'</span> is
67-
defined to be 'medium', so the actual value is 20% larger than
68-
'medium'. The actual value that this results in depends on
69-
the current environment.
70-
</div>
64+
<h3><span class="index-def" title="actual value">
65+
<a name="actual-value">Actual values</a></span></h3>
7166

72-
<h3><a name="actual-value">Actual values</a></h3>
67+
<P>A computed value is in principle ready to be used, but a user agent
68+
may not be able to make use of the value in a given environment. For
69+
example, a user agent may not have a specified font size available, in
70+
which case the user agent must approximate the computed value. The
71+
actual value is the computed value after any approximations have been
72+
applied.
7373

74-
<P>A computed value has an absolute meaning but a user agent may not
75-
be able to respect this meaning in a given environment. For example, a
76-
user agent may not have a specified font size available, in which case
77-
the user agent must approximate the computed value. Computed values
78-
that are transformed to match the current environment are called <span
79-
class="index-def" title="actual value">actual values</span>.
8074

81-
<P>Only actual values are inherited.
75+
<P>Whenever an element inherits a value, it inherits an
76+
actual value.
8277

8378
<H2><a name="inheritance">Inheritance</a></h2>
8479

85-
<P>Some <a href="#actual-value">actual values</a> are <span
86-
class="index-def" title="inheritance of property
87-
values">inherited</span> by the descendants of a node in the <a
88-
href="conform.html#doctree">document tree</a>. Each property
89-
definition specifies whether its value may be inherited.
80+
<P> Some propeties are inherited, i.e., a descendant of a node in the
81+
<a href="conform.html#doctree">document tree</a> will use the node's
82+
actual value for a property unless the property is specified for that
83+
descendant.
84+
85+
<P>All properties accept the 'inherit' keyword. For an inherited
86+
property, this value is merely an explicit statement of the
87+
inheritance. For a property that is not inherited according to its
88+
definition, this value forces inheritance.
9089

9190
<div class="html-example"><P>
92-
Suppose there is an H1 element with an emphasized element inside:
91+
Suppose there is an H1 element with an emphasizing element (EM)
92+
inside:</p>
9393

9494
<PRE>
9595
&lt;H1&gt;The headline &lt;EM&gt;is&lt;/EM&gt; important!&lt;/H1&gt;
@@ -115,28 +115,29 @@ work even if the author omits the BODY tag in the HTML source since
115115
the HTML parser will infer the missing tag.
116116

117117
<div class="example"><P>
118+
For example, since the <span class="propinst-color">'color'</span>
119+
property is inherited, all descendants of the BODY element will
120+
inherit the color 'black':
118121

119-
For example, these rules cause the <span
120-
class="propinst-color">'color'</span> property on the BODY element to
121-
be inherited by all descendants of the BODY element:
122+
<PRE>
123+
BODY { color: black; }
124+
</PRE>
125+
126+
<P>Not all style properties are inherited, for example <span
127+
class="propinst-background">'background'</span>. But in the case of
128+
<span class="propinst-background">'background'</span>, the <em>visual
129+
effect</em> may be propagated to descendants. A
130+
background specified for the root element, as in:</p>
122131

123132
<PRE>
124-
BODY {
125-
color: black;
126-
background: url(texture.gif) white;
127-
}
133+
BODY { background: url(texture.gif) white; }
128134
</PRE>
129135

130-
<P> In this example, all descendants of the BODY element inherit the
131-
<span class="propinst-color">'color'</span> property.
136+
<P>will shine through any descendants unless they specify a value for
137+
<span class="propinst-background-color">'background-color'</span>
138+
other than 'transparent' (the initial value).
132139
</div>
133140

134-
<P>Not all style properties are inherited. For example, the <span
135-
class="propinst-background">'background'</span> property is not
136-
inherited. (However, due to the initial value of 'transparent' on the
137-
<span class="propinst-background">'background'</span> property, the
138-
parent's background shines through.)
139-
140141
<div class="example"><P>
141142
The following example illustrates that <a href="#specified-value">
142143
specified</a> percentage values are not inherited; only
@@ -194,8 +195,10 @@ language. For instance, in HTML, style sheets may be included in the
194195
document or linked externally.
195196

196197
<li><strong>User</strong>: The user may be able to specify style
197-
information for a document. The user agent may provide an interface
198-
that "generates" a user style sheet (or must behave as if it did).
198+
information for a particular document. For example, the user may
199+
specify a file that contains a style sheet or the user agent may
200+
provide an interface that generates a user style sheet (or behave as
201+
if it did).
199202

200203
<li><strong>User agent</strong>: <a
201204
href="conform.html#conformance">Conforming user agents</a> must apply

0 commit comments

Comments
 (0)