css去掉浏览器默认样式

html-css022

css去掉浏览器默认样式,第1张

因为各个浏览器默认的样式不同,你这种情况可以使用下面代码清除边距

<style>*{margin:0padding: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

}

input{-webkit-appearance: none -moz-appearance: none -o-appearance: none appearance: none}

去除input的默认样式用上边的代码就可以实现了。

如果是只去除部分input的默认样式您可以使用class或ID来指定。