每日面试题复习--CSS
CSS篇3
em,rem,px和rpx下次详细整理。
6.什么是初始化css,为什么要初始化?
初始化css就是用来清除一些浏览器默认样式并设置一些统一样式。
比如img,body,p和div等都自带边距。a链接自带下划线和颜色,列表自带圆点,不同浏览器可能不一致。为了清除边距统一布局兼容不同浏览器所以需要进行初始化,如*{margin:0;padding:0;}
下面是部分代码。
body {
font: 12px/150% Arial, Verdana, "\5b8b\4f53;
color: #666;
background: #fff
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,td,img {
margin:0;
padding:0;
}
fieldset, img, input, button {
border: none;
padding: 0;
margin: 0;
outline-style: none;
}
ul, ol { list-style: none;}
input {
padding-top: 0;
padding-bottom: 0;
font-family: "SimSun", "宋体";
}
select, input {
vertical-align: middle;
}
select, input, textarea {
font-size: 12px;
margin: 0;
}
textarea {
resize: none;
}
img {
border: 0;
vertical-align: middle;
}
table {
border-collapse: collapse;
}
a {
color: #666;
text-decoration: none}
a:hover {
color: #C81623;
}
em,rem,px和rpx下次详细整理。
6.什么是初始化css,为什么要初始化?
初始化css就是用来清除一些浏览器默认样式并设置一些统一样式。
比如img,body,p和div等都自带边距。a链接自带下划线和颜色,列表自带圆点,不同浏览器可能不一致。为了清除边距统一布局兼容不同浏览器所以需要进行初始化,如*{margin:0;padding:0;}
下面是部分代码。
body {
font: 12px/150% Arial, Verdana, "\5b8b\4f53;
color: #666;
background: #fff
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,td,img {
margin:0;
padding:0;
}
fieldset, img, input, button {
border: none;
padding: 0;
margin: 0;
outline-style: none;
}
ul, ol { list-style: none;}
input {
padding-top: 0;
padding-bottom: 0;
font-family: "SimSun", "宋体";
}
select, input {
vertical-align: middle;
}
select, input, textarea {
font-size: 12px;
margin: 0;
}
textarea {
resize: none;
}
img {
border: 0;
vertical-align: middle;
}
table {
border-collapse: collapse;
}
a {
color: #666;
text-decoration: none}
a:hover {
color: #C81623;
}
全部评论
相关推荐

点赞 评论 收藏
分享