Previous Message
Next Message

Universal selector vs. body selector

Sent by Bobby Jack on 6 October 2009 15:03


--- On Tue, 10/6/09, Ezequiel Garzón [EMAIL-REMOVED]> wrote:

> 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? 

In addition to the explanations of behaviour that have been given, I'd suggest that you should avoid
the universal selector wherever possible, especially with properties that inherit (as in your
example), since it causes all manner of problems with inheritance. Using:

* { color: black; }

you can no longer make use of inheritance to style, for example, an entire section with a different
colour, since the universal selector will take precedence over inheritance.

More here:

http://www.fiveminuteargument.com/blog/stop-breaking-inheritance

Cheers,

- Bobby
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
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/
Previous Message
Next Message

Message thread: