当写样式时,由于不同浏览器的元素样式不同,导致代码在不同的浏览器运行时样式均不相同,这时候需要清除一些元素的样式
但reset.css也有不足的地方,reset通过为几乎所有的元素施加默认样式,强行使得元素有相同的视觉效果
个人来说,没有必要将reset.css的内容照搬,当某个元素需要重置时,再引入其重置的样式
下面是reset.css的内容
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
reset.css虽然能够清除样式,但
本文探讨了不同浏览器元素样式差异导致的问题,并介绍了reset.css的作用及使用方法。reset.css能有效清除浏览器默认样式,使页面在不同浏览器中保持一致的视觉效果。
2614

被折叠的 条评论
为什么被折叠?



