CSS Reset

为什么要reset

不同的broswer对css属性有不同的初始默认值,如果css里没有overwrite默认的css属性,浏览器使用初始值赋值这些css属性。所以写css之前,我们需要对所有浏览器首先来一次清盘,reset css,以便日后不会出现某明其妙的问题。

Common Reset Property

margin, padding, border, font-size- line-height

 

How to reset in CSS

注意一定要放在css文本的最前面,It's important these styles are the first styles your browser encounter。

Popular Reset CSS源码

Eric Meyer’s “Reset CSS” 2.0实验在我的项目中,一切之前layout或者对其,字体方面奇怪的问题都解决了。

Top Tips for CSS Reset Success

  • Find a CSS Reset that works for you, and customise it.
  • Avoid using the ‘*’ (universal selector) anywhere in your CSS Reset. There’s just no excuse.
  • If you set outline:0 anywhere (esp. on links and form elements), you need to remember to redefine :focus styles, otherwise people who tab through things (like me) can’t work out which element is in focus (usability fail)
  • Once you’ve got your CSS Reset that you like and will always use, keep it on hand and tweak it for each project.
  • Remember – there’s no point setting body { line-height:0 } in the reset, then body { line-height:1.5 } later on, when you could have just set 1.5 to begin with.
posted @ 2013-01-21 04:52  若愚Shawn  阅读(334)  评论(0编辑  收藏  举报