样式清零代码

为了便于统一,一般都会使用一份css清零代码,从而使浏览器的默认样式尽量一致。不过这个东西没有一个标准答案,网上的不一定适合自己的项目,一般做法是下载一套标准的css reset,然后在此基础上根据自己实际情况去删改的。适合自己的以及项目的才是最好的。

接下来就是一份我比较常用的css reset模板。

body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div,dl,dd,dt,input{
	margin: 0; 
	padding: 0; }
body{ font-size: 12px; }
img{ border: none; }
li{ list-style: none; }
input,select,textarea{ outline: none; }
textarea{ resize: none; }
a{ text-decoration: none; }

/*清浮动*/
.clearfix{zoom: 1;}
.clearfix:after{content: ""; display: block;clear: both;}

/*选择*/
::selection{background-color: #669900; color: #ffffff; text-shadow: none;}
::-moz-selection{background-color: #669900; color: #ffffff; text-shadow: none;}

/*去掉a的下划线*/
a{blr:expression(this.onFocus=this.blur())} /*if IE*/


还有一份惊喜版。

*{-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { margin:0; padding:0;}
body { color:rgba(51,51,51,0.8); font-size:14px; font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif; }
td,th,caption { font-size:14px; }
h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; }
address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal;}
a { color:#555; text-decoration:none; }
a:hover { text-decoration: none; }
img { border:none; vertical-align: middle}
ol,ul,li { list-style:none; }
i{font-style: normal;}
input, textarea, select, button { font:14px "Arial","Microsoft YaHei","黑体","宋体",sans-serif;}
input,button{border: none; outline: none;}
input[type=checkbox], input[type=radio]{margin: 0;}
table { border-collapse:collapse; }
html {overflow-y: scroll;}
p{margin: 0;}
.clearfix:after {content: "."; display: block; height:0; clear:both; visibility: hidden;}
.clearfix { *zoom:1; } 

当然这不是万能的,具体情况具体分析,大家还是要根据实际项目去修改,适合自己的才是最好的。希望对你有所帮助。么么哒。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值