Greetings. As you will be able to tell, I'm a CSS rookie. My doubt is,
if the body contains all the other containers, why does body { ... }
behave different from * { ... }? Aren't properties supposed to
cascade? Inheritable properties at least, no? But then I find that
body { color:black; }
and
* { color:black; }
yield different results. For example, the links do not appear in black
in the first case, even though the a selector lives inside the body
selector and the color property is inheritable.
Shed some light, please.
Yes, styles cascade. In your example, you're forgetting (or don't know about)
default styles. So, the default style for the a tag is
a {
color: blue;
text-decoration: underline;
}
It's set that way in the browsers default style sheet.
for the paragraph tag it looks like this:
p {
margin: 1em 0;
}
Note that a has a color assigned, and p does not.
What happens is that you set all the body text to black, and it does cascade
down to p and a. But then the a style gets applied, and it resets the color
inside the a tag to blue.
In the * {color: black} case, it applies color: black to all the tags. This
overwrites a {color:blue} to a {color:black} and your links turn black.
---Tim
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/