国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

瀏覽器CSS Reset的十種方法

2024-07-11 08:40:00
字體:
來源:轉載
供稿:網友

在各種瀏覽器中,都會對CSS的選擇器默認一些數值,譬如當h1沒有被設置數值時,顯示一定大小。但并不是所有的瀏覽器都使 用一樣的數值,所以,有了CSS Reset,以讓網頁的樣式在各瀏覽器中表現一致。

正在使用CSS的你,用過CSS Reset嗎?當然,或許你用了,卻不知道正在用,比如你可能用到:

* { padding: 0; margin: 0; border: 0; }

這也是一款CSS Reset的方法,讓所有的選擇器的padding、margin和border都設置成0。這是一種強大的方法,也是最簡單,最安全的方法,不過,也是 最占用資源的方法。對于小型的網站來說,用這個并不會帶來大的資源浪費,但如果是像Yahoo這種架構非常大的網站,剛需要有選擇地進行CSS重設,以減 少資源浪費。下面是Yahoo的CSS重設代碼,也是受最多人喜愛的CSS Reset方法,YUI選擇的方法是:

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,
form,fieldset,input,textarea,p,blockquote,th,td {
padding: 0;
margin: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-weight: normal;
font-style: normal;
}
ol,ul {
list-style: none;
}
caption,th {
text-align: left;
}
h1,h2,h3,h4,h5,h6 {
font-weight: normal;
font-size: 100%;
}
q:before,q:after {
content:”;
}
abbr,acronym { border: 0;
}

OK,相信你也已經了解了CSS重設的目的,或許你也可以根據自己的喜好,寫一個自己的CSS重設系統,畢竟大家的需求和習慣的不同的。而你可以參照下面的幾款:

Ateneu Popular 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, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt,
var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
:focus { outline: 0;}
a, a:link, a:visited, a:hover, a:active{text-decoration:none}
table { border-collapse: separate;border-spacing: 0;}
th, td {text-align: left; font-weight: normal;}
img, iframe {border: none; text-decoration:none;}
ol, ul {list-style: none;}
input, textarea, select, button {font-size: 100%;font-family: inherit;}
select {margin: inherit;}
hr {margin: 0;padding: 0;border: 0;color: #000;background-color: #000;height: 1px}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 海口市| 肃南| 威远县| 喀喇沁旗| 凤山县| 平果县| 天峨县| 那坡县| 东阿县| 浑源县| 云霄县| 尼木县| 淄博市| 修文县| 织金县| 盐边县| 鄂州市| 石狮市| 彰武县| 察雅县| 武山县| 汝阳县| 广西| 双鸭山市| 建水县| 本溪| 历史| 望奎县| 大冶市| 永兴县| 于田县| 布尔津县| 任丘市| 桃园市| 宿迁市| 香河县| 塔河县| 巴彦县| 连江县| 韶关市| 上林县|