Reset CSS

来源:互联网 发布:职业女装品牌知乎 编辑:程序博客网 时间:2024/05/08 16:37
什么叫做css reset呢?即重置css,也就是重置默认样式。一些标签元素在HTML下有一个默认属性值,我们在写css页面的时候,为了避免在css中重复定义它们,我们需要重置默认样式(css reset)。

以前使用最多*{margin:0;padding:0},但其格式化太严重,慢慢被废弃。
国内大型门户如QQ,taobao等css reset时均有yui的影子。
业内用的最多的还有Erik Meyer’s CSS Reset

个人认为:应根据需求,量体裁衣。

综合yui,Erik,taobao我们就可以写出了自己的css reset。根据项目需求而定。

通常可以这样:

  1. html, body, div, span, applet, object, iframe,  
  2. h1, h2, h3, h4, h5, h6, p, blockquote, pre,  
  3. a, abbr, acronym, address, big, cite, code,  
  4. del, dfn, em, img, ins, kbd, q, s, samp,  
  5. small, strike, strong, sub, sup, tt, var,  
  6. b, u, i, center,  
  7. dl, dt, dd, ol, ul, li,  
  8. fieldset, form, label, legend,  
  9. table, caption, tbody, tfoot, thead, tr, th, td,  
  10. article, aside, canvas, details, embed,  
  11. figure, figcaption, footer, header, hgroup,  
  12. menu, nav, output, ruby, section, summary,  
  13. time, mark, audio, video {  
  14.   margin0;  
  15.   padding0;  
  16.   border0;  
  17.   font: inherit;  
  18.   font-size100%;  
  19.   vertical-alignbaseline;  
  20. }  
  21. a { text-decoration: none;
  22.  }
  1.   
  2. html {  
  3.   line-height1;  
  4. }  
  5.   
  6. ol, ul {  
  7.   list-stylenone;  
  8. }  
  9.   
  10. table {  
  11.   border-collapsecollapse;  
  12.   border-spacing0;  
  13. }  
  14.   
  15. caption, th, td {  
  16.   text-alignleft;  
  17.   font-weightnormal;  
  18.   vertical-alignmiddle;  
  19. }  
  20.   
  21. q, blockquote {  
  22.   quotesnone;  
  23. }  
  24. q:before, q:after, blockquote:before, blockquote:after {  
  25.   content"";  
  26.   contentnone;  
  27. }  
  28.   
  29. a img {  
  30.   bordernone;  
  31. }  
  32.   
  33. article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {  
  34.   displayblock;  
  35. }  




0 0
原创粉丝点击