什么叫做css reset呢?即重置css,也就是重置默认样式。一些标签元素在HTML下有一个默认属性值,我们在写css页面的时候,为了避免在css中重复定义它们,我们需要重置默认样式(css reset)。
以前使用最多*{margin:0;padding:0},但其格式化太严重,慢慢被废弃。
国内大型门户如QQ,taobao等css reset时均有 yui 的影子。
业内用的最多的还有 Erik Meyer’s CSS Reset 。
个人认为:应根据需求,量体裁衣。
以前使用最多*{margin:0;padding:0},但其格式化太严重,慢慢被废弃。
国内大型门户如QQ,taobao等css reset时均有 yui 的影子。
业内用的最多的还有 Erik Meyer’s CSS Reset 。
个人认为:应根据需求,量体裁衣。
综合yui,Erik,taobao我们就可以写出了自己的css reset。根据项目需求而定。
通常可以这样:
- html, body, div, span, applet, object, iframe,
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
- a, abbr, acronym, address, big, cite, code,
- del, dfn, em, img, ins, kbd, q, s, samp,
- small, strike, strong, sub, sup, tt, var,
- b, u, i, center,
- dl, dt, dd, ol, ul, li,
- fieldset, form, label, legend,
- table, caption, tbody, tfoot, thead, tr, th, td,
- article, aside, canvas, details, embed,
- figure, figcaption, footer, header, hgroup,
- menu, nav, output, ruby, section, summary,
- time, mark, audio, video {
- margin: 0;
- padding: 0;
- border: 0;
- font: inherit;
- font-size: 100%;
- vertical-align: baseline;
- }
- a { text-decoration: none;
- }
- html {
- line-height: 1;
- }
- ol, ul {
- list-style: none;
- }
- table {
- border-collapse: collapse;
- border-spacing: 0;
- }
- caption, th, td {
- text-align: left;
- font-weight: normal;
- vertical-align: middle;
- }
- q, blockquote {
- quotes: none;
- }
- q:before, q:after, blockquote:before, blockquote:after {
- content: "";
- content: none;
- }
- a img {
- border: none;
- }
- article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
- display: block;
- }