And they won??™t??”
border properties are not inherited. When we look at the box model
in Chapter 4, we??™ll look at inheritance in greater detail.
Also, you must be careful when working with relative sizes such as
percentages and ems; if you style a tag??™s text to be 80 percent and it??™s
descended from a tag whose text is also sized at 80 percent, its text
size will be 64 percent (80 percent of 80 percent), which is probably
not the effect you want. In Chapter 3, I??™ll cover the pros and cons of
absolute and relative text sizing.
In the examples that follow, we will be examining the effect that
inheritance has on your styles as you write them, and how to make
the most of inherited styles so that you write the minimum amount
of CSS necessary to achieve the desired result.
For now, simply remember that
styles that relate to text and its color
and size are inherited by the descendant
elements. Styles that relate to
the appearance of boxes created by
styling divs, paragraphs, and other
elements, such as borders, padding,
margins, and background colors, are
not inherited.
HOW CSS WORKS 55
The Cascade
OK, now we have enough information to have a meaningful discussion
about one of the toughest aspects of CSS to get your head
around??”the Cascade. If this section gets to be too much, skip ahead
and read the ???Charlie??™s Simple Cascade Summary??? sidebar later in
this chapter.
Pages:
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90