Professor: They are indeed. You can use the next rule as well for almost the same
eect:
body {
font-style: italic;
font-size: 16px;
}
I said “almost, because there is a fund amental dierence between both rules. To
explain it, I first need to clarify in mor e detail how inheritan ce and cascade work, and
tell you about relative units.
4.6 The HTML Ancestry Tree
Professor: As it turned out, you already know by intuition how to use inhe ritance. To
use it properly, however, the intuition is not enough, so we must have a closer look at
it.
To explain how inheritance works, I mu st first tell y ou about the family relationships
between HTML elements. You’ll recall that I’ve already used terms like descendant
and child elements. Every HTML document consists of several elements that are
related to one another in the same way as the family memb ers ar e. The only dierence
is that an HTML element can only have one p arent. We can even draw a family tree
for a n HTML document. For example, the document on page 48 that you had for your
last homework has the family tree shown below.
<h2>
<html>
<a>
<head>
<body >
<link> <article>
<h1>
<p> <p> <p>
<footer>
<title>
<meta>
In computer terminology, each value insid e a tree (represented by a rectan gle in the
above picture) is called a node, and the top node is called the root nod e . Note that o nly
element nodes are shown in the ab ove tree while an HTM L document also contains
the document node and text nodes, which are not interesting for us right now.
Fortunately, there are not as many important relations between HTML elements as
there are between huma n family members. There are no cousins or mothers-in-law,
for example. You must only know these:
4.6. The HTML Ancestry Tree 61
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.150.123