css reset(重置样式)

css reset

重置css,也就是重置默认样式。一些标签元素在HTML下有一个默认属性值,我们在写css页面的时候,

为了避免在css中重复定义它们,我们需要重置默认样式(css reset)。


css reset的作用:

1.符合浏览器兼容性

2.css库


css reset 的正确使用原则:

1.需要重置哪种元素时再进行重置

2.过多的重置样式会导致性能减弱

3.如果没有根据具体的标签设置默认样式,可能会起到相反的作用


有失合理的css reset:

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td { margin: 0;padding: 0; }

需要根据功能设置css reset:

body, dl, dd, h1, h2, h3, h4, h5, h6, p, form{margin:0;}   ol,liul{margin:0; padding:0;}

比较糟糕的是:

div{margin:0; padding:0;}或者*{margin:0; padding:0;}


你可能感兴趣的:(css reset(重置样式))