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

首頁 > 開發 > CSS > 正文

CSS代碼片段:css重置reset css

2024-07-11 09:01:33
字體:
來源:轉載
供稿:網友

武林網(www.survivalescaperooms.com)文章簡介:本css重置參考了normalize.css、bootstrap等,然后根據自己多年的經驗進行了一些簡單的整理并修改,以更適合自己目前的使用及一些大型項目的使用。

本css重置參考了normalize.css、bootstrap等,然后根據自己多年的經驗進行了一些簡單的整理并修改,以更適合自己目前的使用及一些大型項目的使用。

總的來說本css重置包括了三大部分,第一部分是常用的東西(包括常用元素及表單元素),第二部分是html5&css3,第三部分屬于非常用標簽,如果你對本css重置感興趣的話,也可以根據你自己的項目需要對第二部分和第三部分進行刪除。下面我再說下本重置的一些特色。

第一,標題部分采用的是line-height來實現標題于文字的間距,根據中英文有別,一般我們在實際項目中h2的大小為14px,高度為30px的居多。而如bootstrap或normalize.css面對的都是英文字體,所以他們默認設置的字體比中文的要大,且間距也比較大。

第二,根據我們常用的需求給ul添加了兩個class樣式,一個為has-style,顧名思義是擁有列表樣式,因為我們在一開始重置了沒有樣式,但是偶爾有些時候我們又確實需要那個前面的小圓點,所以就有了這個class來還原;另一個為inline-style,即li浮動,不過一般和clearfix結合使用以清除浮動。

第三,對于normalize.css不支持的ie6,我們添加了class以支持。因為ie6不支持屬性選擇器,所以form表單元素的一些重置,我們在normalize.css基礎上添加了class以支持。

第四,你可以根據自己的需要把你用不到的html5&css3或非常用標簽的那部分直接刪掉,以精簡。

當然有些喜歡魚,而有些人更喜歡漁,如果你是后者,那么可以看看normalize.css,那里有更多的代碼注釋給你明確的說明。

2012-10-18更新:因為tahoma這個字體12px看起來確實太小,然后鑒于在蘋果的系統里面helvetica表現比較好,所以默認使用了helvetica和arial字體,而對于表單元素則使用tahoma字體,是因為這個字體能詭異的使表單元素看起來對得比較整齊。

2012-11-06更新:如果你的網站是一些博客類的或是需要貼代碼類型的一般都會應用到pre這個元素,所以添加對pre的處理。

2012-12-20更新:根據soar反饋,里面pre重復了,然后type為search的樣式也有點重復,最后placeholder那個要單獨寫,不能合并在一起,謝謝soar

@charset "utf-8";
/* -------------------------------------------------
* reset css
 * -------------------------------------------------
*/
html{
    height:100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
-webkit-font-smoothing:antialiased;
}
body{
margin:0;
padding:0;
background-color:#fff;
min-height:100%;
height:auto !important;
height:100%;
text-align:center;
color:#404040;
    font:12px/1.5 Helvetica,arial;
}
h1,h2,h3,h4,h5,h6,p,figure,form{
    margin:0;
}
table{
border-collapse:collapse;
border-spacing:0;
}
img{
border:0;
    vertical-align:middle;
    -ms-interpolation-mode: bicubic;
}
a{
text-decoration:none;
color:#29B4F0;
}
a:focus {
    outline: thin dotted;
}
a:hover{
    color:#017CB9;
text-decoration:underline;
}
/* hn */
h1{
font-size:16px;
line-height:36px;
}
h2{
font-size:14px;
line-height:30px;
}
h3{
line-height:24px;
}
h3,h4,h5,h6{
font-size:12px;
}
/* ul ol dl */
ul,li,ol{
    margin: 0;
padding:0;
list-style: none outside none;
}
ul.has-style li,ol li{
margin-left:25px;
}
ul.has-style li{
    list-style:disc;
}
ol li{
list-style:decimal;
}
ul.inline-style li{
float:left;
display:inline;
}
dl{
    margin-bottom: 18px;
}
dt{
    font-weight: bold;
}
dd{
    margin:0 0 0 9px;
padding:0;
}
svg:not(:root) {
    overflow: hidden;
}
/* clearfix */
.clearfix:before, .clearfix:after {
    content:"";
    display:table;
}
.clearfix:after{
clear:both;
overflow:hidden;
}
.clearfix{
    zoom:1;
}
/* -------------------------------------------------
* form
* -------------------------------------------------
*/
button,input,select,textarea{
    font-size:100%;
    font-family:tahoma;
    margin: 0;
outline: 0 none;
    vertical-align: baseline;
    *vertical-align: middle;
}
textarea{
    overflow: auto;
    vertical-align: top;
resize:none;
}
button,input{
    line-height: normal;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"],
.submit-btn{
    -webkit-appearance: button;
    cursor: pointer;
    *overflow: visible;
}
button[disabled],
input[disabled],
.disable{
    cursor: default;
}
input[type="checkbox"],
input[type="radio"],
.form-radio,
.form-checkbox{
    box-sizing: border-box;
    padding: 0;
    *height: 13px;
    *width: 13px;
}
fieldset{
    border: 1px solid #c0c0c0;
    margin: 0 2px 18px;
    padding: 0.35em 0.625em 0.75em;
}
legend{
    border: 0;
    padding: 0;
    white-space: normal;
    *margin-left: -7px;
}
button::-moz-focus-inner,
input::-moz-focus-inner{
    border: 0;
    padding: 0;
}
/* -------------------------------------------------
* css3 & html5
* -------------------------------------------------
*/
/* html5 */
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{
    display: block;
}
audio,canvas,video{
    display: inline-block;
    *display: inline;
    *zoom: 1;
}
audio:not([controls]){
    display: none;
    height: 0;
}
input[type="search"]{
    -webkit-appearance: textfield;
    -moz-box-sizing: content-box;
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
}
:-moz-placeholder{
  color: #999;
}
::-webkit-input-placeholder{
  color: #999;
}
/* -------------------------------------------------
* 非常見標簽
* -------------------------------------------------
*/
abbr[title]{
    border-bottom: 1px dotted;
}
b,strong{
    font-weight: bold;
}
blockquote{
    margin: 1em 40px;
}
dfn{
    font-style: italic;
}
mark{
    background: #ff0;
    color: #444;
}
code,kbd,pre,samp{
    font-family: monospace, serif;
    _font-family: 'courier new', monospace;
    font-size: 1em;
}
pre{
    margin: 1em 0;
white-space: pre;
    white-space: pre-wrap;
    word-wrap: break-word;
}
q{
    quotes: none;
}
q:before,
q:after{
    content: '';
    content: none;
}
small{
    font-size: 80%;
}
sub,sup{
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}
sup{
    top: -0.5em;
}
sub{
    bottom: -0.25em;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 淄博市| 永定县| 凤山市| 临武县| 玉树县| 东光县| 嘉定区| 潞西市| 南城县| 江油市| 闽清县| 威远县| 柳江县| 姚安县| 花垣县| 平潭县| 德清县| 汝阳县| 泰来县| 仙居县| 定边县| 孟津县| 措勤县| 高雄县| 东至县| 石屏县| 花莲县| 齐齐哈尔市| 临潭县| 池州市| 福建省| 绥芬河市| 璧山县| 曲麻莱县| 尖扎县| 称多县| 麻江县| 龙陵县| 鄂伦春自治旗| 临颍县| 佛坪县|