css: the meaning of * mark

后端 未结 3 1586
孤独总比滥情好
孤独总比滥情好 2020-12-03 22:08

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

*{
   margin:0 auto;
   padding:0;
  }
相关标签:
3条回答
  • 2020-12-03 22:24

    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 讨论(0)
  • 2020-12-03 22:25

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

    0 讨论(0)
  • 2020-12-03 22:38

    * 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").

    0 讨论(0)
提交回复
热议问题