12、引用元素的引號(hào)
某些瀏覽器中,q或者blockquote前后會(huì)出現(xiàn)引號(hào)。這個(gè)并不是誰(shuí)都喜歡的。所以需要重置他。 YUI的比較簡(jiǎn)單,只重置了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的了,對(duì)于樣式重置,細(xì)致一點(diǎn)周到一點(diǎn)總沒(méi)有錯(cuò)。
13、鏈接
對(duì)于鏈接,YUI和Eric都沒(méi)有采取樣式重置,但從我思考許久后還是決定把鏈接樣式重置放進(jìn)來(lái)。究其原因,還是因?yàn)闃邮街刂靡粊?lái)要徹底,二來(lái)對(duì)于鏈接樣式并非所有設(shè)計(jì)師都喜歡用下劃線裝飾。因此,我還是建議把鏈接的下劃線重置掉。
a { text-decoration: none; }
但這樣做有點(diǎn)粗糙。真正有下劃線樣式的其實(shí)只有 :link和:visited所以改成下面這樣比較好:
:link, :visited { text-decoration: none; }
此外,對(duì)于鏈接顏色,可以作為reset后急需設(shè)置的規(guī)則來(lái)處理。直接放入reset.css中不是很合適。
14、我的重置樣式
總結(jié)上面種種規(guī)則,這里給出一下我的CSS重置規(guī)則,BSD協(xié)議發(fā)布,請(qǐng)隨意使用。測(cè)試樣本(這個(gè)是從 YUI那里復(fù)制過(guò)來(lái)的 ,感謝YUI為此做出的貢獻(xiàn)。) 下載: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; }
出處:藍(lán)色理想
責(zé)任編輯:bluehearts
上一頁(yè) 打造自己的Reset.css [4] 下一頁(yè) 打造自己的Reset.css [6]
◎進(jìn)入論壇網(wǎng)頁(yè)制作、WEB標(biāo)準(zhǔn)化版塊參加討論,我還想發(fā)表評(píng)論。
|