网站的css初始化

几乎所有的网站都需要单独写初始化代码,自己写了一些网页,总结了一下常用的css初始化代码,希望能对大家有所帮助。

cssReset:

/*根据需求自己编写css初始化代码,可被不同页面引用*/
@charset "utf-8"; /*css字符编码*/
html {
	color: #000;  /*所有的字体均继承*/
	background: #fff; 
}
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
form,
fieldset,
input,
textarea,
p,
blockquote,
th,
td {
	margin: 0;
	padding: 0;
}
/*只写网页布局所需用的标签,优化性能,减轻服务器负担*/
table {
	border-collapse: collapse;  /*合并单元格边框*/
	border-spacing: 0;  /*设置单元格边框之间的距离为0*/
}
s,
a {
	text-decoration: none;
}
em,
strong,
b,
u,
i {
	font-style: normal;
	font-weight: normal;
}
ol,
ul {
	list-style: none;  /*清除小点*/
}
h1,
h2,
h3 {
	font-size: 100%;
	font-weight: normal; /*标题不加粗*/
}
input,
textarea,
select {
	font-family: inherit;   /*inherit不支持ie8*/
	font-size: inherit;     /*规定应该从父元素继承字体尺寸*/
	font-weight: inherit;
	*font-size: %100;  /*兼容ie浏览器*/ /*%100表示默认大小*/
}
img {
	border: 0 none; /*只写none(适用于ie)有兼容性问题*/
}
input {
	border: 0 none; /*只写none(适用于ie)有兼容性问题*/
	outline: 0;
}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值