- index.html中引用:
<link rel="stylesheet" href="./static/css/reset.css">
- 代碼如下:
@charset "utf-8";
/*!
* @名稱:reset.css
* @功能:1、重設瀏覽器默認樣式
* 2、設置通用原子類
*/
/* 防止用戶自定義背景顏色對網頁的影響,添加讓用戶可以自定義字體 */
html {
background:white;
color:black;
overflow-y: scroll; /* 讓非ie瀏覽器默認也顯示垂直滾動條,防止因滾動條引起的閃爍 */
}
/* 內外邊距通常讓各個瀏覽器樣式的表現位置不同 */
article,aside,
body,button,blockquote,
code,
div,dl,dt,dd,details,
figcaption,figure,footer,form,fieldset,
header,hgroup,hr,h1,h2,h3,h4,h5,h6,
input,
li,legend,
menu,
nav,
ol,
p,pre,
section,
th,td,textarea,
ul
{margin:0;padding:0;}
/* 設置默認字體 */
body,button, input, select, textarea {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
font-size: 12px;
}
/* 來自yahoo,讓標題都自定義,適應多個系統應用 */
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:500;
}
h1 { font-size: 18px; /* 18px / 12px = 1.5 */ }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4, h5, h6 { font-size: 100%; }
input,select,textarea {
font-size:100%;
}
address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:500;}/* 將斜體扶正 */
code, kbd, pre, samp, tt { font-family: "Courier New", Courier, monospace; } /* 統一等寬字體 */
small { font-size: 12px; } /* 小於 12px 的中文很難閱讀,讓 small 正常化 */
/*默認不顯示下劃線,保持頁面簡潔*/
a,ins{ text-decoration: none; }
/* 讓鏈接在 hover 狀態下顯示下劃線 */
a:hover { text-decoration: underline; }
/* 去除 ie6 & ie7 焦點點狀線 */
a:focus,*:focus {outline:none;}
/* 注:1.ie6 不支持 abbr; 2.這裏用了屬性選擇符,ie6 下無效果 */
abbr[title], acronym[title] {border-bottom: 1px dotted;cursor: help;}
/* 去掉 firefox 下此元素的邊框 */
abbr,acronym {border:none;font-variant:normal;}
/* 一致的 del 樣式 */
del {text-decoration:line-through;}
/* img 搭車:讓鏈接裏的 img 無邊框 */
fieldset, img { border: none; }
/* 重置 hr */
hr {border: none;height: 1px;}
/* ie6 7 8(q) bug 顯示爲行內表現 */
iframe {display:block;}
/* for ie6 */
legend { color: #000; }
/*<q> 標籤定義短的引用。
瀏覽器經常在引用的內容周圍添加引號。*/
q:before, q:after { content: ''; }
/* 統一上標和下標 */
sub,sup {
font-size:75%;
line-height:0;
position:relative;
vertical-align:baseline;
}
sup {
top:-0.5em;
}
sub {
bottom:-0.25em;
}
table {border-collapse: collapse;border-spacing: 0;}
/* ie bug:th 不繼承 text-align */
th { text-align:inherit;}
/* 重置列表元素 去掉列表前的標識,li 會繼承*/
ul, ol { list-style: none; }
/*超出內容顯示省略號*/
.ellipsis{ max-width: 100%; white-space: nowrap; text-overflow:ellipsis; overflow:hidden; }
/* 設置浮動,減少浮動帶來的 bug */
.fl,.fr {display:inline;}
.fl {float:left;}
.fr {float:right;}
/*清除浮動*/
.clearfix { zoom: 1; }
.clearfix:before,
.clearfix:after { display: table; line-height: 0; content: ""; }
.clearfix:after { clear: both; overflow:hidden; }
.clear {
clear:both;
display:block;
font-size:0;
height:0;
line-height:0;
overflow:hidden;
}
/* 設置顯示和隱藏,通常用來與 js 配合 */
.hide {display:none;}
.show{display:block;}