关于css reset
关于css reset
为什么要reset?
因为不同浏览器,不同版本的浏览器对html页面的默认渲染都有那么一些的差别,导致了应用与设想效果的差别,简单说就是css bug。
消除这些默认样式(css reset )可以避免很多浏览器兼容性的问题。
浏览器默认的css样式一般包括这些节点,有兴趣可以参考yui 的css reset
简单的css reset
view sourceprint?
- YUI 3 CSS RESET<BR>/*
- Copyright (c) 2010, Yahoo! Inc. All rights reserved.
- Code licensed under the BSD License:
- http://developer.yahoo.com/yui/license.html
- version: 3.3.0
- build: 3167
- */
- /*
- TODO will need to remove settings on HTML since we can't namespace it.
- TODO with the prefix, should I group by selector or property for weight savings?
- */
- html{
- color:#000;
- background:#FFF;
- }
- /*
- TODO remove settings on BODY since we can't namespace it.
- */
- /*
- TODO test putting a class on HEAD.
- - Fails on FF.
- */
- body,
- div,
- dl,
- dt,
- dd,
- ul,
- ol,
- li,
- h1,
- h2,
- h3,
- h4,
- h5,
- h6,
- pre,
- code,
- form,
- fieldset,
- legend,
- input,
- textarea,
- p,
- blockquote,
- th,
- td {
- margin:0;
- padding:0;
- }
- table {
- border-collapse:collapse;
- border-spacing:0;
- }
- fieldset,
- img {
- border:0;
- }
- /*
- TODO think about hanlding inheritence differently, maybe letting IE6 fail a bit...
- */
- address,
- caption,
- cite,
- code,
- dfn,
- em,
- strong,
- th,
- var {
- font-style:normal;
- font-weight:normal;
- }
- /*
- TODO Figure out where this list-style rule is best set. Hedger has a request to investigate.
- */
- li {
- list-style:none;
- }
- caption,
- th {
- text-align:left;
- }
- h1,
- h2,
- h3,
- h4,
- h5,
- h6 {
- font-size:100%;
- font-weight:normal;
- }
- q:before,
- q:after {
- content:'';
- }
- abbr,
- acronym {
- border:0;
- font-variant:normal;
- }
- /* to preserve line-height and selector appearance */
- sup {
- vertical-align:text-top;
- }
- sub {
- vertical-align:text-bottom;
- }
- input,
- textarea,
- select {
- font-family:inherit;
- font-size:inherit;
- font-weight:inherit;
- }
- /*to enable resizing for IE*/
- input,
- textarea,
- select {
- *font-size:100%;
- }
- /*because legend doesn't inherit in IE */
- legend {
- color:#000;
- }
复制代码
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论