8000 [css2] Added definition of "document tree", "parent", etc. · w3c/csswg-drafts@b20ad26 · GitHub
Skip to content

Commit b20ad26

Browse files
committed
[css2] Added definition of "document tree", "parent", etc.
(See http://lists.w3.org/Archives/Member/w3c-css-wg/1997OctDec/0014.html) --HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%40223
1 parent 84644fb commit b20ad26

1 file changed

Lines changed: 110 additions & 27 deletions

File tree

css2/conform.src

Lines changed: 110 additions & 27 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 1.17 1997-10-03 22:12:36 ian Exp $ -->
3+
<!-- $Id: conform.src,v 1.18 1997-10-09 14:41:20 bbos Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>Definitions and document conventions</TITLE>
@@ -24,11 +24,26 @@ include "P" (for structuring paragraphs), "TABLE" (for creating
2424
tables), "OL" (for creating ordered lists), etc.
2525

2626

27-
<H3><a name="doctree">Document tree</a></H3>
27+
<H3><a name="doctree">Document tree, parent, child, descendant,
28+
ancestor</a></H3>
2829

29-
<P>When a document written in the document language is parsed by a user
30-
agent, the result is a <span class="index-def" title="document
31-
tree">document tree structure</span>.
30+
<P>CSS makes use of the fact that a document in the document language
31+
can be thought of as a tree: every element except one has exactly one
32+
<span class="index-def" title="parent">parent</span> element. (See the
33+
SGML and XML specifications[ref] for the definition of parent.) The one
34+
exception is the <span class="index-def" title="root">root</em>
35+
element, which has no parent. An element A is called a <span
36+
class="index-def" title="child">child</span> of an element B, if and
37+
only if B is the parent of A.
38+
39+
<P>An element A is called a <span class="index-def"
40+
title="ancestor">ancestor</span> of an element B, if either (1) A is
41+
the parent B, or (2) A is the parent of some element C that is an
42+
ancestor of B.
43+
44+
<P>An element A is called a <span class="index-def"
45+
title="descendant">descendant</span> of an element B, if and only if B
46+
is an ancestor of A.
3247

3348
<div class="example"><P>
3449
For example, the following HTML document:
@@ -63,14 +78,18 @@ refer to the text this program: the title text, the paragraph text, and
6378
the list item text.
6479
-->
6580

66-
<P>The <span class="index-def" title="root element"><em>root
67-
element</em></span> of a document is the element at the top of the
68-
document tree.
81+
<H3><span class="index-def" title="inheritance">Inheritance of
82+
property values</span></H3>
6983

70-
<H3><span class="index-def" title="inheritance">Inheritance</span></H3>
84+
<P>CSS works, basically, by converting the document tree to a tree of
85+
rendering objects that are characterized by properties. A property has
86+
a name, such as 'font-weight' and a value, for example 'bold'. All
87+
rendering objects have the same properties, but the values may
88+
differ. The values can be set explicitly, but if they are not, the
89+
values are either inherited, or set to an "initial" value.
7190

72-
<P>Elements inherit some property values from their ancestors in the
73-
document tree.
91+
<P>If a value is inherited, it means the value is the same as the
92+
value in the rendering object for the parent element.
7493

7594
<div class="example"><P>
7695
Suppose there is an H1 element with an emphasized element inside:
@@ -79,21 +98,22 @@ Suppose there is an H1 element with an emphasized element inside:
7998
&lt;H1&gt;The headline &lt;EM&gt;is&lt;/EM&gt; important!&lt;/H1&gt;
8099
</PRE>
81100

82-
<P> If no color has been assigned to the EM element, the emphasized
83-
"is" will inherit the color of the parent element, i.e., it will also
84-
appear in blue.
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
103+
color blue, the EM element will likewise be in blue.
85104
</div>
86105

106+
<!--
87107
<P>Other style properties are likewise inherited, e.g., <span
88108
class="propinst-font-family">'font-family'</span> and <span
89109
class="propinst-font-size">'font-size'</span>.
90-
110+
-->
91111

92112
<P> To set a "default" style property for a document, one can set the
93113
property on the root of the document tree. In HTML, the HTML or BODY
94-
elements can serve this function. This will work even if the author
95-
omits the BODY tag in the HTML source since the HTML parser will
96-
infer the missing tag.
114+
elements can serve this function. Note that this will work even if the
115+
author omits the BODY tag in the HTML source since the HTML parser
116+
will infer the missing tag.
97117

98118
<div class="example"><P>
99119

@@ -114,23 +134,70 @@ element:
114134

115135
<P> Not all style properties are inherited. For example, the <span
116136
class="propinst-background">'background'</span> property is not
117-
inherited. However, by default, when an element has no explicit
118-
background, its parent's background shines through.
137+
inherited. (However, by default, when an element has no explicit
138+
background, its parent's background shines through.) All properties
139+
have an initial value. If the property is not inherited, the value
140+
will be the initial value.
119141

120-
Thus, in the example above, the <span
142+
<!--
143+
<P>Thus, in the example above, the <span
121144
class="propinst-background">'background'</span> property on the BODY
122145
element, although not inherited, establishes the background of the
123146
entire document. The background will be white if the image is not
124147
available (see the section on <a href="./colors.html#backgrounds">
125148
backgrounds</a> for more information).
149+
-->
126150

127151
<P>Each property definition indicates whether the property is
128-
inherited by child elements.
152+
inherited by child elements, and what the initial value of the
153+
property is.
154+
155+
<P>The root element obviously can't inherit values. If no value is set
156+
explicitly, the initial value will be used.
129157

130158
<P>For all inherited CSS2 properties, if the value is specified as a
131159
percentage, child elements inherit the resultant value, not the
132160
percentage value.
133161

162+
<div class="example"><P>
163+
For example, with the style sheet
164+
<pre>
165+
BODY {font-size: 10pt}
166+
H1 {font-size: 120%}
167+
</pre>
168+
169+
<p>and the document fragment
170+
171+
<pre>
172+
&lt;BODY>
173+
&lt;H1>A &lt;EM>large&lt;/EM> heading&lt;/H1>
174+
...
175+
</pre>
176+
177+
<p>the H1 will have <span
178+
class="prop-inst-font-size">'font-size'</span> 12pt (120% times 10pt),
179+
but the EM will also be 12pt, since it inherits the resultant value
180+
(12pt), not the percentage (120%).
181+
</div>
182+
183+
<P>When a percentage value is set on a property of the root element,
184+
and the percentage is defined as referring to the inherited value of
185+
some property X, the resultant value is the percentage times the
186+
initial value of property X.
187+
188+
<div class="example"><P>
189+
For example, with and HTML document and the style sheet
190+
<pre>
191+
HTML {font-size: 120%}
192+
</pre>
193+
194+
<p>The resultant value for <span
195+
class="prop-inst-font-size">'font-size'</span> will be 120% of the
196+
initial value of the 'font-size' property. (The initial value of
197+
'font-size' is defined to be 'medium', so the resultant value is 20%
198+
larger than 'medium'.)
199+
</div>
200+
134201
<H3><span class="index-def" title="user agent|UA">User
135202
agent</span> (or UA)</H3>
136203

@@ -204,18 +271,24 @@ impairments or may provide the choice to disable blinking.</P>
204271
<H3><span class="index-def" title="default style sheet">Default style
205272
sheet</span></H3>
206273

207-
<P>When a document has no associated style sheets, user agents apply
274+
<P>A user agent can provide a default style sheet, so that even
275+
when a document has no associated style sheets, user agents apply
208276
rules from their default style sheet for presenting the document. A
209277
user agent's default style sheet generally presents elements of the
210278
document language in ways that satisfy the expectations that most people
211279
have (e.g., for visual browsers, the EM element in HTML is presented
212-
using an italic font). The default style sheet is considered along
213-
with author and user style sheets when determining how rules <a
214-
href="cascade.html">cascade</a>.
280+
using an italic font).
281+
282+
<P>If a document has associated style sheets, the default style sheet
283+
is considered along with author and user style sheets when determining
284+
how rules <a href="cascade.html">cascade</a>.
215285

216286
<P>User agents that don't actually use style sheets to specify default
217287
rules must behave as if they did.
218288

289+
<P>See <a href="sample.html">"A sample style sheet for HTML 2.0"</a>
290+
for a recommended default style sheet for HTML 4.0 documents.
291+
219292
<H3><span class="index-def" title="visual rendering model">Visual
220293
rendering model</span></H3> The <a href="./flowobj.html">visual
221294
rendering model</a> describes how user agents should format a stream
@@ -261,7 +334,7 @@ definition.
261334
<li> non-terminals that have the same range of values as a property
262335
bearing the same name (e.g., &lt;border-width&gt;
263336
&lt;background-attachment&gt;, etc.). In this case, the non-terminal
264-
names is the property name (complete with quotes) between "&lt;" and
337+
name is the property name (complete with quotes) between "&lt;" and
265338
"&gt;" (e.g., &lt;'border-width'&gt;). In the electronic version of
266339
the document, each instance of this type of non-terminal links to the
267340
corresponding property definition.
@@ -353,3 +426,13 @@ letters (e.g., src, class, id).
353426

354427

355428

429+
<!-- Keep this comment at the end of the file
430+
Local variables:
431+
mode: sgml
432+
sgml-declaration:"~/SGML/HTML4.decl"
433+
sgml-default-doctype-name:"html"
434+
sgml-minimize-attributes:t
435+
sgml-nofill-elements:("pre" "style" "br")
436+
sgml-live-element-indicator:t
437+
End:
438+
-->

0 commit comments

Comments
 (0)