开发者

css: the meaning of * mark

Can you tell me what's the meaning of this:

*{
   margin:0 auto;
开发者_JS百科   padding:0;
  }


* matches everything. That particular snippet is setting the default padding for everything to 0,0,0,0 and the default margins to 0, auto (that is, vertical margins are 0, horizontal margins are "auto").


* is a wild card. It means the style applies to all tags


that is a wildcard that will effect all the child nodes of the document node. Every DOM element basically on the page. You always wanna put that at the beginning of the CSS otherwise it will overrule all the other rules above it.

I recommend using css reset style sheets. One of the best is on Yahoos YUI project, google I believe also has it. This will do all the initializing of the css and reseting everything for every browser so everything you do will look the same regardless of the user agent. the reason I really recommend this for you is because you are a beginner and you will be banging your head against the wall like I did when css first came out and none of these were available. You can also jump into fun things rather than dealing with these sort of rules. It will also speed the performance if you link to it on google or yahoos server. this is totally legal and thats what they are serving it for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜