我的css框架——base.css(重設(shè)瀏覽器默認(rèn)樣式)
發(fā)布時(shí)間:2013-03-19 15:16:15 作者:佚名
我要評(píng)論

有自己css框架在網(wǎng)頁布局過程中會(huì)顯得相當(dāng)容易,本文提供的是本人的經(jīng)驗(yàn)之談主要功能在于重設(shè)瀏覽器默認(rèn)樣式,熱愛布局的你可千萬不要錯(cuò)過了哈,希望可以幫助到你
復(fù)制代碼
代碼如下:@charset "utf-8";
/*
@名稱: base
@功能: 重設(shè)瀏覽器默認(rèn)樣式
*/
/* 防止用戶自定義背景顏色對(duì)網(wǎng)頁的影響,添加讓用戶可以自定義字體 */
html {
color:black;
background:white;
}
/* 內(nèi)外邊距通常讓各個(gè)瀏覽器樣式的表現(xiàn)位置不同 */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
margin:0;
padding:0;
}
/* 要注意表單元素并不繼承父級(jí) font 的問題 */
body,button,input,select,textarea {
font:12px SimSun,tahoma,arial,sans-serif;
}
input,select,textarea {
font-size:100%;
}
/* 去掉各Table cell 的邊距并讓其邊重合 */
table {
border-collapse:collapse;
border-spacing:0;
}
/* IE bug fixed: th 不繼承 text-align*/
th {
text-align:inherit;
}
/* 去除默認(rèn)邊框 */
fieldset,img {
border:none;
}
/* ie6 7 8(q) bug 顯示為行內(nèi)表現(xiàn) */
iframe {
display:block;
}
/* 去掉 firefox 下此元素的邊框 */
abbr,acronym {
border:none;
font-variant:normal;
}
/* 一致的 del 樣式 */
del {
text-decoration:line-through;
}
address,caption,cite,code,dfn,em,th,var {
font-style:normal;
font-weight:500;
}
/* 去掉列表前的標(biāo)識(shí), li 會(huì)繼承 */
ol,ul {
list-style:none;
}
/* 對(duì)齊是排版最重要的因素, 別讓什么都居中 */
caption,th {
text-align:left;
}
/* 來自yahoo, 讓標(biāo)題都自定義, 適應(yīng)多個(gè)系統(tǒng)應(yīng)用 */
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:500;
}
q:before,q:after {
content:'';
}
/* 統(tǒng)一上標(biāo)和下標(biāo) */
sub, sup {
font-size:75%;
line-height:0;
position:relative;
vertical-align:baseline;
}
sup {
top:-0.5em;
}
sub {
bottom:-0.25em;
}
/* 讓鏈接在 hover 狀態(tài)下顯示下劃線 */
a:hover {
text-decoration:underline;
}
/* 默認(rèn)不顯示下劃線,保持頁面簡潔 */
ins,a {
text-decoration:none;
}
/* IE6,7焦點(diǎn)點(diǎn)狀線去除 */
a:focus,*:focus {
outline:none;
}
/* 清除浮動(dòng) */
.clearfix:before,.clearfix:after {
content:"";
display:table;
}
.clearfix:after {
clear:both;
overflow:hidden;
}
.clearfix {
zoom:1; /* for IE6 IE7 */
}
.clear{
clear:both;
display:block;
overflow:hidden;
height:0;
line-height:0;
font-size:0;
}
/* 設(shè)置顯示和隱藏, 通常用來與 JS 配合 */
.hide {
display:none !important;
visibility:hidden;
}
.block {
display:block !important;
}
/* 設(shè)置內(nèi)聯(lián), 減少浮動(dòng)帶來的bug */
.fl {
float:left;
display:inline;
}
.fr {
float:right;
display:inline;
}
相關(guān)文章
CSS重置(CSS Reset) 讓網(wǎng)頁樣式在各瀏覽器中表現(xiàn)一致
CSS Reset是指重設(shè)瀏覽器的樣式,在各種瀏覽器中,都會(huì)對(duì)CSS的選擇器默認(rèn)一些數(shù)值,譬如當(dāng)h1沒有被設(shè)置數(shù)值時(shí),顯示一定大小;有了CSS Reset,讓網(wǎng)頁的樣式在各瀏覽器中表現(xiàn)2012-12-21- reset.css本意就是重置樣式,我始終建議把.clearfix放入layout.css,而把h1、h2之類的定義放進(jìn)typography.css2012-04-01
- 作為一個(gè)半路出家的的csser,偶深深滴理解小鳥們滴郁悶之處。其中最讓鳥頭大的就是相同的CSS在不同的瀏覽器下表現(xiàn)出不同滴鳥樣兒。2009-11-12
- 網(wǎng)頁制作Webjx文章簡介:本文就是來介紹如何寫一個(gè)合適所有項(xiàng)目的通用的reset.css,以及介紹在設(shè)置玩reset.css之后需要針對(duì)不同項(xiàng)目要首先要設(shè)置的內(nèi)容。2009-04-02
- CSS樣式清除和重置是前端開發(fā)必需要做的事情,結(jié)合了前輩們的經(jīng)驗(yàn)整理了一份CSS重置樣式代碼不敢獨(dú)享特此與大家分享下,感興趣的朋友可不要錯(cuò)過了哈2013-05-20