Css Reset(复位)整理
Css Reset是什么? 有些同行叫 "css复位",有些可能叫 "默认css".....
相信看完全文您会对Css Reset有个重新的认识
原文地址:
http://perishablepress.com/press/2007/10/23/a-killer-collection-of-global-css-reset-styles/
PS:
1 |
*{ |
2 |
padding:0; |
3 |
margin:0; |
4 |
} |
这就是最常用的Css Reset,但是这里会有很多问题。
原文前部分说了很多关于Css,以及各浏览器的css规则的不同,而制定"CssReset"也是为了兼容与统一,正确有效的使用"Css Reset"可以在某种程度上节约时间与金钱.
非常感谢Perishable的整理与归纳
下面是关于几类Css Reset的简单介绍,本人能力有限.只能理解大概意思,还请各位看官见谅.
Minimalistic Reset [ Version 1 ]
相信这一段你经常看到.而且也是我们经常用到的
*{
padding:0;
margin:0;
}
Minimalistic Reset [ Version 2 ]
border:0的设计有些不靠谱了
来源:(http://blog.sina.com.cn/s/blog_5d8975f30100f7j6.html) - Css Reset(复位)整理_沫鱼_新浪博客
1 |
*{ |
2 |
padding:0; |
3 |
margin:0; |
4 |
border:0; |
5 |
} |
Minimalistic Reset [ Version 3 ]
当然这个也是不推荐的.会跟某些默认样式有冲突
1 |
*{ |
2 |
outline:0; |
3 |
padding:0; |
4 |
margin:0; |
5 |
border:0; |
6 |
} |
Condensed Universal Reset
这是作者当前比较钟意的一种写法.保证了相对普遍浏览器样式的统一性.
01 |
*{ |
02 |
vertical-align:baselinebaseline; |
03 |
font-weight:inherit; |
04 |
font-family:inherit; |
05 |
font-style:inherit; |
06 |
font-size:100%; |
07 |
border: 0none; |
08 |
outline:0; |
09 |
padding:0; |
10 |
margin:0; |
11 |
} |
Poor Man’s Reset
其实这也是我们常用的一类Css Reset.对字体的大小复位,以及图片链接的边框处理.
也经常在某些站点看到
01 |
html, body{ |
02 |
padding:0; |
03 |
margin:0; |
04 |
} |
05 |
html { |
06 |
font-size:1em; |
07 |
} |
08 |
body { |
09 |
font-size:100%; |
10 |
} |
11 |
a img, :link img, :visited img{ |
12 |
border:0; |
13 |
} |
Shaun Inman’s Global Reset
作者认为Shaun写这类的Css Reset是有某种目的性.
而且这类规则是针对的是某些重要的常用浏览器.
比如ie,firefox等
01 |
body, div, dl, dt, dd, ul, ol, li, h1, h2,h3, h4, h5, h6,pre, |
02 |
form, fieldset, input, p, blockquote, table, th, td, embed, object{ |
03 |
padding:0; |
04 |
margin:0; |
05 |
} |
06 |
table { |
07 |
border-collapse:collapse; |
08 |
border-spacing:0; |
09 |
} |
10 |
fieldset, img, abbr{ |
11 |
border:0; |
12 |
} |
13 |
address, caption, cite, code, dfn,em, |
14 |
h1, h2, h3, h4, h5, h6, strong, th, var{ |
15 |
font-weight:normal; |
16 |
font-style:normal; |
17 |
} |
18 |
ul { |
19 |
list-style:none; |
20 |
} |
21 |
caption, th{ |
22 |
text-align:left; |
23 |
} |
24 |
h1, h2, h3, h4, h5, h6{ |
25 |
font-size:1.0em; |
26 |
} |
27 |
q:before, q:after{ |
28 |
content:''; |
29 |
} |
30 |
a, ins{ |
31 |
text-decoration:none; |
32 |
} |
Yahoo CSS Reset
01 |
yahoo这帮家伙写的Reset个人觉得可以推荐 |
02 |
|
03 |
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form, |
04 |
fieldset,input,textarea,p,blockquote,th,td{ |
05 |
padding:0; |
06 |
margin:0; |
07 |
} |
08 |
table { |
09 |
border-collapse:collapse; |
10 |
border-spacing:0; |
11 |
} |
12 |
fieldset,img{ |
13 |
border:0; |
14 |
} |
15 |
address,caption,cite,code,dfn,em,strong,th,var{ |
16 |
font-weight:normal; |
17 |
font-style:normal; |
18 |
} |
19 |
ol,ul { |
20 |
list-style:none; |
21 |
} |
22 |
caption,th{ |
23 |
text-align:left; |
24 |
} |
25 |
h1,h2,h3,h4,h5,h6{ |
26 |
font-weight:normal; |
27 |
font-size:100%; |
28 |
} |
29 |
q:before,q:after{ |
30 |
content:''; |
31 |
} |
32 |
abbr,acronym { border:0; |
33 |
} |
Erik Meyer’s CSS Reset
作者将Erik Meyer的代码重新整理了.但功能上还是一样的
这套Css Reset是业内是使用最多的
01 |
html, body, div, span, applet, object,iframe, table, caption, tbody, tfoot, thead, tr, th,td, |
02 |
del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike,strong, sub, sup, tt,var, |
03 |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym,address, big, cite,code, |
04 |
dl, dt, dd, ol, ul, li, fieldset, form, label, legend{ |
05 |
vertical-align:baselinebaseline; |
06 |
font-family:inherit; |
07 |
font-weight:inherit; |
08 |
font-style:inherit; |
09 |
font-size:100%; |
10 |
outline:0; |
11 |
padding:0; |
12 |
margin:0; |
13 |
border:0; |
14 |
} |
15 |
|
16 |
:focus{ |
17 |
outline:0; |
18 |
} |
19 |
body { |
20 |
background:white; |
21 |
line-height:1; |
22 |
color:black; |
23 |
} |
24 |
ol, ul{ |
25 |
list-style:none; |
26 |
} |
27 |
|
28 |
table { |
29 |
border-collapse:separate; |
30 |
border-spacing:0; |
31 |
} |
32 |
caption, th, td{ |
33 |
font-weight:normal; |
34 |
text-align:left; |
35 |
} |
36 |
|
37 |
blockquote:before, blockquote:after, q:before, q:after{ |
38 |
content:""; |
39 |
} |
40 |
blockquote, q { |
41 |
quotes: """"; |
42 |
} |
43 |
|
44 |
Condensed Meyer Reset |
45 |
总的来说这是对Erik Meyer的Css Reset的修改与提升. |
46 |
|
47 |
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3,h4, h5,h6, |
48 |
pre, form, fieldset, input, textarea, p, blockquote, th, td{ |
49 |
padding:0; |
50 |
margin:0; |
51 |
} |
52 |
fieldset, img{ |
53 |
border:0; |
54 |
} |
55 |
table { |
56 |
border-collapse:collapse; |
57 |
border-spacing:0; |
58 |
} |
59 |
ol, ul{ |
60 |
list-style:none; |
61 |
} |
62 |
address, caption, cite, code, dfn, em, strong, th, var{ |
63 |
font-weight:normal; |
64 |
font-style:normal; |
65 |
} |
66 |
caption, th{ |
67 |
text-align:left; |
68 |
} |
69 |
h1, h2, h3, h4, h5, h6{ |
70 |
font-weight:normal; |
71 |
font-size:100%; |
72 |
} |
73 |
q:before, q:after{ |
74 |
content:''; |
75 |
} |
76 |
abbr, acronym{ |
77 |
border:0; |
78 |
} |

浙公网安备 33010602011771号