CSS全局样式如何实现,有哪些方面要注意
发布时间:2023-10-12 09:59:31 所属栏目:语言 来源:
导读:今天这篇给大家分享的知识是“CSS全局样式怎样实现,有哪些方面要注意”,小编觉得挺不错的,对大家学习或是工作可能会有所帮助,对此分享发大家做个参考,希望这篇“CSS全局样式怎样实现,有哪些方面
今天这篇给大家分享的知识是“CSS全局样式怎样实现,有哪些方面要注意”,小编觉得挺不错的,对大家学习或是工作可能会有所帮助,对此分享发大家做个参考,希望这篇“CSS全局样式怎样实现,有哪些方面要注意”文章能帮助大家解决问题。 牛顿是站在巨人伽利略的肩膀上的,我们也可以这么做。通过高手们的经 验,下面两个细节需要注意。你可以检查一下你设计网站或者博客的全局CSS。 不建议用:*{margin:0;padding:0;} 不建议用:* {margin:0;padding:0;}的原因: *这个感觉不是很好,肯定会影响效率的,尽管不能被肉眼察觉 性能的消耗是其中一个因素,个人认为会带来的最大弊端还是对表单元素的影响。比如checkbox、radio、button之类的标 签,被定义后在浏览器上的显示很别扭,需要针对性重写代码,消耗的是更多的代码量和代码时间。 但是针对一些简单得页面,标签元 素单一且简单得话,就可以大胆地使用。 建 议使用:img {border:0 none;} 原因是为了兼容,因为border边框属性在不同浏览器中的渲染方式不同。 比 如FF和IE中,仅仅使用img {border:0;}的话,那么在两个浏览器中border-width都是为0的,但是border-style和border-color两个属性 会存在差异。 具体分析结果可以查看:http://blog.linxz.cn/border/ reset.css样本 那些没有提到 的标签如何全局定义就要看具体情况了,比如你的项目中没有使用的标签,你何必全局定义呢? 下面的reset.css大部分复制至:YUI。 提 醒:不能尽信高手。没有最完美的,只有最合适的。 body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td { margin: 0; padding: 0; } fieldset, img { border: 0 none; } /* remember to define focus styles! */ :focus { outline: 0; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { font-style: normal; font-weight: normal; } h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: normal; } abbr, acronym { border: 0; font-variant: normal; } input, button, textarea, select, optgroup, option { font-family: inherit; font-size: inherit; font-style: inherit; font-weight: inherit; } code, kbd, samp, tt { font-size: 100%; } /*@purpose To enable resizing for IE */ /*@branch For IE6-Win, IE7-Win */ input, button, textarea, select { *font-size: 100%; } body { line-height: 1.5; } ol, ul { list-style: none; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: collapse; border-spacing: 0; } caption, th { text-align: left; } sup, sub { font-size: 100%; vertical-align: baseline; } /* remember to highlight anchors and inserts somehow! */ :link, :visited , ins { text-decoration: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐