首页 / CSS / 网页设计:重置CSS样式表
网页设计:重置CSS样式表
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了网页设计:重置CSS样式表,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2637字,纯文字阅读大概需要4分钟。
内容图文
![网页设计:重置CSS样式表](/upload/InfoBanner/zyjiaocheng/1055/14d88117e36f4252a4a474a4228eb34e.jpg)
转自豆瓣:http://www.douban.com/note/330400235/
网页设计:重置CSS样式表
网页设计,让人最头疼的莫过于让页面兼容各大浏览器,准确些是兼容它们“默认”的CSS样式表。这样,“抹掉”这些默认样式表成了首要问题,也就有了CSS样式表重置一说,目前用的最多的,也是自己现在正在用的方法是,添加以下代码:
第一种方式
* {margin:0px; padding:0px;}
现在众多的设计师发现,这行代码虽然简单,但却让网页解析太慢,呵呵,当然了,自己是业余的,不用太在意。
于是出现了几种CSS重置方法:
第二种方式
NETTUTS上的 Jeffrey Way写了篇文章Weekend Quick Tip: Create Your Own Simple Reset.css File
释出自己用来重置CSS样式表的方法
1 body, html, div, blockquote, img, label, p, h1, h2, h3, h4, h5, h6, pre, ul, ol, 2 li, dl, dt, dd, form, a, fieldset, input, th, td 3 {margin: 0; padding: 0; border: 0; outline: none;} 4body{line-height: 1;font-size: 88% /* Decide for yourself if you want to include this. */;} 5h1, h2, h3, h4, h5, h6{font-size: 100%;padding: .6em 0;margin: 0 15px;} 6ul, ol{list-style: none;} 7a{color: black;text-decoration: none;} 8a:hover 9 {text-decoration: underline;} 10.floatLeft{float: left;padding: .5em .5em .5em 0;} 11.floatRight{float: right;padding: .5em 0 .5em .5em;}
这个方法适用于大多数的网页设计。
第三种方式
一部分人追求彻底抹去浏览器影响
1 html, body, div, span, applet, object, iframe, 2 h1, h2, h3, h4, h5, h6, p, blockquote, pre, 3 a, abbr, acronym, address, big, cite, code, 4 del, dfn, em, font, img, ins, kbd, q, s, samp, 5 small, strike, strong, sub, sup, tt, var, 6 b, u, i, center, 7 dl, dt, dd, ol, ul, li, 8 fieldset, form, label, legend, 9 table, caption, tbody, tfoot, thead, tr, th, td { 10 margin: 0; 11 padding: 0; 12 border: 0; 13 outline: 0; 14 font-size: 100%; 15 vertical-align: baseline; 16 background: transparent; 17 } 18body {line-height: 1;} 19ol, ul {list-style: none;} 20blockquote, q {quotes: none;} 21blockquote:before, blockquote:after, 22q:before, q:after {content: ‘‘;content: none;} 2324/* remember to define focus styles! */25:focus {outline: 0;} 2627/* remember to highlight inserts somehow! */28ins {text-decoration: none;} 29del { text-decoration: line-through;} 3031/* tables still need ‘cellspacing="0"‘ in the markup */32table {border-collapse: collapse;border-spacing: 0;}
第四种方式
还有今天sofish提到的Yahoo的YUI提供的CSS重置文件
1 body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { 2 margin:0; 3 padding:0; 4 } 5table {border-collapse:collapse;border-spacing:0;} 6fieldset,img { border:0;} 7address,caption,cite,code,dfn,em,strong,th,var {font-style:normal; 8font-weight:normal;} 9ol,ul {list-style:none;} 10caption,th {text-align:left;} 11h1,h2,h3,h4,h5,h6 {font-size:100%;font-weight:normal;} 12q:before,q:after {content:‘‘;} 13abbr,acronym { border:0;}
这些,没有谁好谁坏一分,大多数设计师并不推荐第一种方法,因为我国的抄袭美德,现在搜索到的CSS网页设计技巧,第一位却一定是这个。
转自豆瓣:http://www.douban.com/note/330400235/
原文:http://www.cnblogs.com/zoeyll/p/4380095.html
内容总结
以上是互联网集市为您收集整理的网页设计:重置CSS样式表全部内容,希望文章能够帮你解决网页设计:重置CSS样式表所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。