首頁  >  文章  >  web前端  >  html元素有哪些自備樣式,如何去除

html元素有哪些自備樣式,如何去除

coldplay.xixi
coldplay.xixi原創
2021-03-04 14:29:123261瀏覽

html元素有預設樣式,去除的方法:1、全域移除預設樣式,程式碼為【*{padding:0;margin:0;box-sizing:..}】;2、a標籤移除預設樣式,程式碼為【a{text-decoration: none;color:#3】。

html元素有哪些自備樣式,如何去除

本教學操作環境:windows7系統、html5版,DELL G3電腦。

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标签的四种状态都和本身颜色保持一致,样式代码自己写
}

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;
    /*在选择框的最右侧中间显示小箭头图片*/
    background: url("http://ourjs.github.io/static/2015/arrow.png") no-repeat scroll right center transparent;
    padding-right: 14px;
}

7、h1

h1,h2,h3,h4,h5,h6{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影片教學

#

以上是html元素有哪些自備樣式,如何去除的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn