導航:首頁 > 版本升級 > css清除默認樣式文件

css清除默認樣式文件

發布時間:2023-11-12 10:44:57

『壹』 css去掉瀏覽器默認樣式


/**清除內外邊距**/
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,/*structuralelements結構元素*/
dl,dt,dd,ul,ol,li,/*listelements列表元素*/
pre,/*textformattingelements文本格式元素*/
form,fieldset,legend,button,input,textarea,/*formelements表單元素*/
th,td/*tableelements表格元素*/{
margin:0;
padding:0;
}
/**設置默認字體**/
body,
button,input,select,textarea/*forie*/{
font:14px/1.5tahoma,5b8b4f53,sans-serif;
}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
address,cite,dfn,em,var{font-style:normal;}/*將斜體扶正*/
code,kbd,pre,samp{font-family:couriernew,courier,monospace;}/*統一等寬字體*/
small{font-size:12px;}/*小於12px的中文很難閱讀,讓small正常化*/
/**重置列表元素**/
ul,ol{list-style:none;}
/**重置文本格式元素**/
a{text-decoration:none;}
a:hover{text-decoration:underline;}
sup{vertical-align:text-top;}/*重置,減少對行高的影響*/
sub{vertical-align:text-bottom;}
/**重置表單元素**/
legend{color:#000;}/*forie6*/
fieldset,img{border:0;}/*img搭車:讓鏈接里的img無邊框*/
button,input,select,textarea{font-size:100%;}/*使得表單元素在ie下能繼承字體大小*/
/*註:optgroup無法扶正*/
/**重置表格元素**/
table{border-collapse:collapse;border-spacing:0;}
/*重置HTML5元素*/
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,
summary,time,mark,audio,video{
display:block;
margin:0;
padding:0;
}
mark{background:#ff0;}

理念:
1. reset 的目的不是清除瀏覽器的默認樣式, 這僅是部分工作. 清除和重置是緊密不可分的.
2. reset 的目的不是讓默認樣式在所有瀏覽器下一致, 而是減少默認樣式有可能帶來的問題.
3. reset 期望提供一套普適通用的基礎樣式. 但沒有銀彈, 推薦根據具體需求, 裁剪和修改後再使用.

『貳』 css去掉瀏覽器默認樣式

因為各個瀏覽器默認的樣式不同,你這種情況可以使用下面代碼清除邊距
<style>*{margin:0;padding:0;}</style>建議做網站的時候,設置個reset.css樣式表清除各個瀏覽器的默認樣式,已達到做的網頁在各個瀏覽器中達到統一,下面把YUI
Reset
CSS代碼貼出
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
margin:0;
padding:0;
}
table {
border-collapse:collapse;
border-spacing:0;
}
fieldset,img {
border:0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-style:normal;
font-weight:normal;
}
ol,ul {
list-style:none;
}
caption,th {
text-align:left;
}
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:normal;
}
q:before,q:after {
content:'';
}
abbr,acronym { border:0;
}

『叄』 如何用css樣式去掉默認設備或者瀏覽器的默認樣式

手機設備下的界面

正常瀏覽器下的html5界面

要解決該問題需要加入一些css樣式,如下:

input[type="button"], input[type="submit"], input[type="reset"] {

-webkit-appearance: none;

-moz-appearance: none;

appearance: none;

}

如果還有圓角的問題,

.button{ border-radius: 0; }

在寫表單時候會發現一些瀏覽器對表單賦了默認的樣式,如在谷歌瀏覽器下,文本框和下拉選擇框當載入焦點時,會出現發光的邊框!文本框textarea可以自由拖拽拉大!在IE10下,文本框輸入內容後,會在右側出現一個小叉叉。面對這些問題,下面來看看解決方法。

去除谷歌等瀏覽器文本框默認發光邊框

input:focus, textarea:focus {

outline: none;

}

去掉高光樣式:

input:focus{

-webkit-tap-highlight-color:rgba(0,0,0,0);

-webkit-user-modify:read-write-plaintext-only;

}

也可以重新根據自己的需要設置一下,如:

input:focus,textarea:focus {

outline: none;

border: 1px solid #f60;

}

這樣的話,當文本框載入焦點時,邊框顏色就會變為橙色,增強用戶體驗!

去除IE10+瀏覽器文本框後面的小叉叉

input::-ms-clear {

display: none;

}

禁止多行文本框textarea拖拽

添加屬性多行文本框就不能拖拽放大縮小了:

textarea {

resize: none;

}

閱讀全文

與css清除默認樣式文件相關的資料

熱點內容
數據怎麼拷貝在電腦上 瀏覽:980
linux調整磁碟空間 瀏覽:749
蘋果6s顯示不了4g網路連接伺服器 瀏覽:554
iphone5s照相機聲音怎麼關 瀏覽:389
iphoneitunes恢復 瀏覽:121
轉轉app怎麼下載米家 瀏覽:575
win10硬碟管理在哪個位置 瀏覽:723
微信視頻黑調整 瀏覽:677
如何破解u盤密碼 瀏覽:47
jsp程序包不存在 瀏覽:261
討論組里的文件怎麼刪 瀏覽:419
nsatool免疫工具 瀏覽:640
無線網路結構性 瀏覽:98
南方gass怎麼載入數據 瀏覽:406
收聽央廣新聞用什麼app聽 瀏覽:626
樂播足球app 瀏覽:257
如何在文件夾中找到英雄聯盟 瀏覽:927
清理手機qq緩存圖片嗎 瀏覽:320
tyt文件 瀏覽:144
系統進不去原來桌面上的文件 瀏覽:545

友情鏈接