网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网页制作 > CSS
网页制作:Dreamweaver教程,FrontPages教程,Javascript教程,HTML教程,CSS教程,心得技巧,DHTML教程,网页特效,Discuz!论坛
本月文章推荐
.css技巧:批量保存div+css图片方.
.GridView固定表头(不用javascrip.
.css弹出层+屏蔽背景页面(兼容fie.
.导航上用CSS标志当前页效果的实现.
.CSS对页面文字链接的设置大全.
.网页布局中CSS的Class灵活应用.
.CSS设计网页时的一些常用规范.
.css图像映射.
.合理使用HTML标签进行CSS布局.
.CSS制作圆角导航的另一思路.
.DIV+CSS与XHTML+CSS是什么意思?.
.css彩色虚线表格及JS鼠标指向单元.
.第三章 CSS的应用补充.
.解决IE6不能正常解析CSS文件的方.
.如何高效的学习css.
.CSS层叠顺序.
.CSS欺骗,让背景不能滚动.
.CSS教程关于css框架网页设计.
.CSS网页布局的意义与副作用.
.CSS中慎用中文注释.

Css Reset(复位)整理

发表日期:2008-10-1


Css Reset是什么? 有些同行叫 "css复位",有些可能叫 "默认css".....
相信看完全文您会对Css Reset有个重新的认识

原文地址:
http://perishablepress.com/press/2007/10/23/a-killer-collection-of-global-css-reset-styles/

PS:

* {   
 padding: 0;   
 margin: 0;   
 } 

这就是最常用的Css Reset,但是这里会有很多问题。

原文前部分说了很多关于Css,以及各浏览器的css规则的不同,而制定"Css Reset"也是为了兼容与统一,正确有效的使用"Css Reset"可以在某种程度上节约时间与金钱.

非常感谢Perishable的整理与归纳

下面是关于几类Css Reset的简单介绍,本人能力有限.只能理解大概意思,还请各位看官见谅.

Minimalistic Reset [ Version 1 ]
相信这一段你经常看到.而且也是我们经常用到的

* {   
 padding: 0;   
 margin: 0;   
 }  

Minimalistic Reset [ Version 2 ]
border:0的设计有些不靠谱了

* {   
 padding: 0;   
 margin: 0;   
 border: 0;   
 }
Minimalistic Reset [ Version 3 ]
当然这个也是不推荐的.会跟某些默认样式有冲突

* {   
 outline: 0;   
 padding: 0;   
 margin: 0;   
 border: 0;   
 }   

Condensed Universal Reset
这是作者当前比较钟意的一种写法.保证了相对普遍浏览器样式的统一性.

* {   
 vertical-align: baselinebaseline;   
 font-weight: inherit;   
 font-family: inherit;   
 font-style: inherit;   
 font-size: 100%;   
 border: 0 none;   
 outline: 0;   
 padding: 0;   
 margin: 0;   
 }
Poor Man’s Reset
其实这也是我们常用的一类Css Reset.对字体的大小复位,以及图片链接的边框处理.
也经常在某些站点看到

html, body {   
 padding: 0;   
 margin: 0;   
 }   
html {   
 font-size: 1em;   
 }   
body {   
 font-size: 100%;   
 }   
a img, :link img, :visited img {   
 border: 0;   
 }   

Shaun Inman’s Global Reset
作者认为Shaun写这类的Css Reset是有某种目的性.
而且这类规则是针对的是某些重要的常用浏览器.
比如ie,firefox等

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre,    
form, fieldset, input, p, blockquote, table, th, td, embed, object {   
 padding: 0;   
 margin: 0;    
 }   
table {   
 border-collapse: collapse;   
 border-spacing: 0;   
 }   
fieldset, img, abbr {   
 border: 0;   
 }   
address, caption, cite, code, dfn, em,    
h1, h2, h3, h4, h5, h6, strong, th, var {   
 font-weight: normal;   
 font-style: normal;   
 }   
ul {   
 list-style: none;   
 }   
caption, th {   
 text-align: left;   
 }   
h1, h2, h3, h4, h5, h6 {   
 font-size: 1.0em;   
 }   
q:before, q:after {   
 content: '';   
 }   
a, ins {   
 text-decoration: none;   
 }   

Yahoo CSS Reset
yahoo这帮家伙写的Reset个人觉得可以推荐

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,
fieldset,input,textarea,p,blockquote,th,td {    
 padding: 0;   
 margin: 0;   
 }   
table {   
 border-collapse: collapse;   
 border-spacing: 0;   
 }   
fieldset,img {    
 border: 0;   
 }   
address,caption,cite,code,dfn,em,strong,th,var {   
 font-weight: normal;   
 font-style: normal;   
 }   
ol,ul {   
 list-style: none;   
 }   
caption,th {   
 text-align: left;   
 }   
h1,h2,h3,h4,h5,h6 {   
 font-weight: normal;   
 font-size: 100%;   
 }   
q:before,q:after {   
 content:'';   
 }   
abbr,acronym { border: 0;   
 }
Erik Meyer’s CSS Reset
作者将Erik Meyer的代码重新整理了.但功能上还是一样的
这套Css Reset是业内是使用最多的

html, body, div, span, applet, object, iframe, table, caption, tbody, tfoot, thead, tr, th, td,    
del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,    
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,    
dl, dt, dd, ol, ul, li, fieldset, form, label, legend {   
 vertical-align: baselinebaseline;   
 font-family: inherit;   
 font-weight: inherit;   
 font-style: inherit;   
 font-size: 100%;   
 outline: 0;   
 padding: 0;   
 margin: 0;   
 border: 0;   
 }   
/* remember to define focus styles! */  
:focus {   
 outline: 0;   
 }   
body {   
 background: white;   
 line-height: 1;   
 color: black;   
 }   
ol, ul {   
 list-style: none;   
 }   
/* tables still need cellspacing="0" in the markup */  
table {   
 border-collapse: separate;   
 border-spacing: 0;   
 }   
caption, th, td {   
 font-weight: normal;   
 text-align: left;   
 }   
/* remove possible quote marks (") from <q> & <blockquote> */  
blockquote:before, blockquote:after, q:before, q:after {   
 content: "";  
 }  
blockquote, q {  
 quotes: "" "";   
 }   

Condensed Meyer Reset
总的来说这是对Erik Meyer的Css Reset的修改与提升.

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6,    
pre, form, fieldset, input, textarea, p, blockquote, th, td {    
 padding: 0;   
 margin: 0;   
 }   
fieldset, img {    
 border: 0;   
 }   
table {   
 border-collapse: collapse;   
 border-spacing: 0;   
 }   
ol, ul {   
 list-style: none;   
 }   
address, caption, cite, code, dfn, em, strong, th, var {   
 font-weight: normal;   
 font-style: normal;   
 }   
caption, th {   
 text-align: left;   
 }   
h1, h2, h3, h4, h5, h6 {   
 font-weight: normal;   
 font-size: 100%;   
 }   
q:before, q:after {   
 content: '';   
 }   
abbr, acronym {    
 border: 0;   
 }   

最后有份关于Css Reset的使用者调查
http://css-tricks.com/poll-results-what-css-reset-do-you-use/

上一篇:CSS教程:表格的nobr终极解决方案 人气:864
下一篇:纯CSS实现的可包含html的title提示 人气:914
浏览全部Css的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐