开发者

Does Reset.css affects other stylesheets?

I am starting a new project, so i thought to start using Reset.css in my projects. i got the concept of using Reset.css, but one thing is bothering me is that does if affects my other style applied on the same el开发者_运维技巧ement.. like in reset.css div have 0 margin and 0 padding... and if i apply margin to some of the divs in my stylesheet, wont it get disturbed?

Please clear my this doubt


Not if the style applied to your other divs is more SPECIFIC.

http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/

In general any style applied using a class, or an id in the selector is going to take precedence over one which doesn't. But there are many other rules in this area you should become aware of.

i.e.

 div.myStyle {...}

will always overrule

 div {...}


You have to include reset.css first and then include your own stylesheet file. and be sure that your styles wont be overwritten by reset.php.


What you neeed to do is load reset.css as a first style sheet. Anything else loaded after it will be overriding reset.css

e.g if you specify in reset css: p { margin: 0px; padding: 0px} and than load style.css with style: p {margin: 2px; padding: 2px}

The style load as last one will be used.

I personaly use technic with

* { margin: 0px; padding: 0px; border: 0px; outline: none; list-style: none;}

Put it at the top of css file and job done:) No need for extra .css fil.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜