untitled

(John Hannent) #1
told us to use contextual. So, rather than wait for their next edict, I think I’ll
just continue using the term contextual.

The result of the following code with its contextual selector is shown in
Figure 14-4:

<html>
<head>

<style>
p i {border-bottom: 1px solid;}
</style>

</head>

<body>

<h1>This <i>is not</i> underlined</h1>

<p>However, this italics element is a descendant of a
paragraph, so <i>it does</i>get underlined.</p>

</body>
</html>

Selecting by context rather than grouping ....................................


As you doubtless noticed, and applauded more than once, I’ve rarely repeated
myself in this book. However, because of the similarity between grouping and
contextual selectors, I’ll repeat myself here. Don’t get this contextual selectors

Figure 14-4:
The
browser
knows you
want only
paragraph
italics
underlined,
not head-
line italics.

258 Part IV: Advanced CSS Techniques

Free download pdf