CSS样式初始化原因:
不同浏览器对每种的标签都有默认的样式,大部分浏览器的默认样式还有点区别。所以为了保证
让所有的标签的默认样式清零,也就是重置,以便于我们后续的开发和管理,一般都会在网站一开始
对所有标签做一下样式的 重置操作。
比如:body 标签有默认的margin: 8px。
ul标签:有默认的list-style样式,圆点。
超链接标签及a标签:蓝色字体,都有下划线
标题标签: 都有加粗,字体变大的效果。
Strong,em标签:字体自动进行加粗。
p标签:内容有上下margin
典型的YUI的CSS Reset样式的地址(yui3):
PC页面 cssReset.css
@charset "utf-8";
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;
}
a {
text-decoration: none;
}
em,
strong,
b,
u,
i{
font-style: normal;
font-weight: normal;
}
ol,
ul {
list-style: none;
}
h1,
h2,
h3,{
font-weight:normal;
}
input,
textarea,
select {
font-family:inherit;
font-size:inherit;
font-weight:inherit;
*font-size:100%; /*to enable resizing for IE*/
}
img{
border:0 none;
}
注意:1 标签没有用到,但是设置默认样式,会导致性能下降。
所以上面css标签默认样式设置没有添加h4,h5,h6
2 list-style: none; 去圆点
html中添加css样式文件