Prev | Current Page 195 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

This is not the same as if
we had specified the following:
div, p, a {
font-size: 130%;
}
In the above code, the p element would be 130% bigger than its parent div, and the
nested anchor element would be 130% bigger still than the p element. Take care
when you??™re setting percentage and em font sizes on nested elements, or this sort of
compounding will occur.
135 The Cascade, Specificity, and Inheritance
As we already mentioned (before we were sidetracked!), only some properties are
inherited from the parent automatically. The reason for this is quite obvious if you
think about it. If, for instance, borders were inherited from the parent, the result
would look very messy! Not only would the parent element have a border, but so
would every child element; the result would be disastrous.
The foreground color is inherited by default, but backgrounds aren??™t. Again, the
reason for this is obvious: in most cases, you??™d want the foreground color to be
inherited by child elements, but if the parent element had a background image, you
wouldn??™t want the child elements to have the same image, as their background
images probably conflict with their parent??™s background image.


Pages:
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207