溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

html中全局去除默認樣式的方法

發(fā)布時間:2021-03-04 14:47:25 來源:億速云 閱讀:1046 作者:小新 欄目:web開發(fā)

小編給大家分享一下html中全局去除默認樣式的方法,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

html元素有默認樣式,去除的方法:1、全局去除默認樣式,代碼為【*{padding:0;margin:0;box-sizing:..}】;2、a標簽去除默認樣式,代碼為【a{text-decoration: none;color:#3】。

html元素有默認樣式,去除的方法:

1、全局去除默認樣式

*{padding:0;margin:0;box-sizing: border-box;font-size: 14px;}

2、a標簽去除默認樣式

 a{text-decoration: none;color:#333;}
 a:hover, a:visited, a:link, a:active {
    color:#333;
    // 設置使所有a標簽的四種狀態(tài)都和本身顏色保持一致,樣式代碼自己寫
}

3、li

ul,ol{list-style: none;}

4、img

img{
  vertical-align:top;
  border:none;
}

5、button

.button{
    border:0;
    background-color:none
    outline:none;
    -webkit-appearance: none;//用于IOS下移除原生樣式
}

6、select

select {
    border: none;
    appearance:none;
    -moz-appearance:none;
    -webkit-appearance:none;
    /*在選擇框的最右側(cè)中間顯示小箭頭圖片*/
    background: url("http://ourjs.github.io/static/2015/arrow.png") no-repeat scroll right center transparent;
    padding-right: 14px;
}

7、h2

h2,h3,h4,h5,h6,h7{font-weight:normal;}

8、input,textarea

input,textarea {
    outline: none;
    border: none;
}
textarea {
    resize: none;
    overflow: auto;
}

9、斜體 i

i{font-style: normal;}

10、table

table{border-collapse:collapse;border-spacing:0;}

11、去除input[type=number]加減號

/*去除input[type=number]加減號*/
/* 谷歌 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
/* 火狐 */
input{
    -moz-appearance:textfield;
}

以上是“html中全局去除默認樣式的方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI