覆蓋瀏覽器默認樣式,去除user agent stylesheet 的影響

在設計網頁查看本身的css效果時,有時候會發現本身寫的樣式沒法起做用,查看了一下樣式,發現是user agent stylesheet 的樣式將咱們寫的樣式給覆蓋了,user agent stylesheet 是瀏覽器默認的樣式,瀏覽器的css樣式渲染了咱們的html,因此纔會出現這種問題,因此咱們寫前臺頁面的時候首先要對前臺頁面初始化,這是一個很好的習慣。css

清除瀏覽器樣式的初始化代碼:html

html{color:#000;background:#FFF;}   
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;   
}   
@charset "utf-8";  
*{  
    margin: 0px;  
    padding: 0px;  
      
}   
a{  
    text-decoration: none;  
    color: #000000;  
    font-size:15px;  
    /*字體*/  
}  
li{  
    list-style: none;  
}  
input,img{  
    border: none;  
}  
相關文章
相關標籤/搜索