The other tag or tags state the containing ancestor tag(s)
in which the target tag must be contained for it to be affected by the
rule. Let??™s look at this idea in detail.
We??™ll work with this bit of sample markup
Contextual selectors are very selective.
This example shows how to target a speci?¬? c tag
using the document hierarchy.
Tags only need to be descendants in the order
stated in the selector; other tags can be in
between and the selector still works.
If you are new to XHTML, note that
span is a neutral container like
div that has no default attributes:
in other words, span has no effect
on your markup until you explicitly
style it. It??™s useful for marking up
elements in your markup that have
some meaning to you not de?¬? ned
by XHTML; however, if your document
?¬? nds itself in an environment
where it cannot use your style sheet,
the spans will have no effect on the
presentation. Unlike div, which is
a block element and forces a new
line, span is an inline element, so it
does not force a new line. By default,
strong results in bold text, and em
(emphasis) results in italics; but of
course, you can use CSS to restyle
them if you wish.
HOW CSS WORKS 35
Note that the ?¬? rst paragraph contains an em element; the second
paragraph??™s em element is nested inside a span tag.
Pages:
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67