Welcome to WebmasterWorld Guest from 54.205.170.21

Forum Moderators: not2easy

Message Too Old, No Replies

What is meant * {} in CSS?

   
10:29 am on Dec 27, 2011 (gmt 0)



What is meant


*
{...}


in CSS file.
11:36 am on Dec 27, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



The * is the universal selector; it matches any element. So your example will apply the style rule to every element.
11:40 am on Dec 27, 2011 (gmt 0)



Thanks.
10:02 pm on Dec 27, 2011 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



OK, now I'm curious. Are there any circumstances where you would legitimately do this? As opposed to, say,
html {blahblah}
and letting everyone else inherit from there. Are we talking size, color, what?
10:38 pm on Dec 27, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



he he, one of those questions where the answer begs the question ;).

Not all properties inherit by default Appendix F. Full property table [w3.org], and not all versions would apply inherit even if explicitly set. Hence the popularity of variations of:
* {
margin:0;
border:0;
}

But as the universal selector is very inefficient I think the real message in the question really is to ask if it is the best way to achieve the desired outcome. Legimate? I guess that depends on the code-complexity/code inefficiency trade-off

edit reason
Clarify
 

Featured Threads

Hot Threads This Week

Hot Threads This Month