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


在設計網頁查看自己的css效果時,有時候會發現自己寫的樣式無法起作用,查看了一下樣式,發現是user agent stylesheet 的樣式將我們寫的樣式給覆蓋了,user agent stylesheet 是瀏覽器默認的樣式,瀏覽器的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;  
}  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM