12、引用元素的引号
某些浏览器中,q或者blockquote前后会出现引号。这个并不是谁都喜欢的。所以需要重置他。 YUI的比较简单,只重置了q:
q:before, q:after { content: ''; }
而Eric则比较周到,把q和blockquote都重置了。
blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }
OK,就决定用Eric的了,对于样式重置,细致一点周到一点总没有错。
13、链接
对于链接,YUI和Eric都没有采取样式重置,但从我思考许久后还是决定把链接样式重置放进来。究其原因,还是因为样式重置一来要彻底,二来对于链接样式并非所有设计师都喜欢用下划线装饰。因此,我还是建议把链接的下划线重置掉。
a { text-decoration: none; }
但这样做有点粗糙。真正有下划线样式的其实只有 :link和:visited所以改成下面这样比较好:
:link, :visited { text-decoration: none; }
此外,对于链接颜色,可以作为reset后急需设置的规则来处理。直接放入reset.css中不是很合适。
14、我的重置样式
总结上面种种规则,这里给出一下我的CSS重置规则,BSD协议发布,请随意使用。测试样本(这个是从 YUI那里复制过来的 ,感谢YUI为此做出的贡献。) 下载:reset.css reset-min.css
/* Copyright (c) 2009, Shawphy(shawphy.com). All rights reserved. http://shawphy.com/2009/03/my-own-reset-css.html Based on YUI http://developer.yahoo.com/yui/reset/ and Eric Meyer http://meyerweb.com/eric/tools/css/reset/index.html Licensed under the BSD License: http://creativecommons.org/licenses/BSD/ version: 1.1 | 20090303 */ 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; } fieldset, img { border: 0; } /* remember to define focus styles! */ :focus { outline: 0; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { font-style: normal; font-weight: normal; } h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: normal; } abbr, acronym { border: 0; font-variant: normal; } input, button, textarea, select, optgroup, option { font-family: inherit; font-size: inherit; font-style: inherit; font-weight: inherit; } code, kbd, samp, tt { font-size: 100%; } /*@purpose To enable resizing for IE */ /*@branch For IE6-Win, IE7-Win */ input, button, textarea, select { *font-size: 100%; } body { line-height: 1.5; } ol, ul { list-style: none; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: collapse; border-spacing: 0; } caption, th { text-align: left; } sup, sub { font-size: 100%; vertical-align: baseline; } /* remember to highlight anchors and inserts somehow! */ :link, :visited , ins { text-decoration: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }
出处:蓝色理想
责任编辑:bluehearts
上一页 打造自己的Reset.css [4] 下一页 打造自己的Reset.css [6]
◎进入论坛网页制作、WEB标准化版块参加讨论,我还想发表评论。
|