PHP程序研究

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

源码文件:reset.css

 

代码
1 /*
2 KISSY CSS Reset
3 理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。
4 2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。
5 3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。
6 特色:1. 适应中文;2. 基于最新主流浏览器。
7 维护:玉伯<lifesinger@gmail.com>, 正淳<ragecarrier@gmail.com>
8  */
9
10  /** 清除内外边距 **/
11 body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */
12 dl, dt, dd, ul, ol, li, /* list elements 列表元素 */
13 pre, /* text formatting elements 文本格式元素 */
14 form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */
15 th, td /* table elements 表格元素 */ {
16 margin: 0;
17 padding: 0;
18  }
19
20  /** 设置默认字体 **/
21 body,
22 button, input, select, textarea /* for ie */ {
23 font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif;
24  }
25 h1, h2, h3, h4, h5, h6 { font-size: 100%; }
26 address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */
27 code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */
28 small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */
29
30  /** 重置列表元素 **/
31 ul, ol { list-style: none; }
32
33  /** 重置文本格式元素 **/
34 a { text-decoration: none; }
35 a:hover { text-decoration: underline; }
36
37 sup { vertical-align: text-top; } /* 重置,减少对行高的影响 */
38 sub { vertical-align: text-bottom; }
39
40 /** 重置表单元素 **/
41 legend { color: #000; } /* for ie6 */
42 fieldset, img { border: 0; } /* img 搭车:让链接里的 img 无边框 */
43 button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */
44 /* 注:optgroup 无法扶正 */
45
46 /** 重置表格元素 **/
47 table { border-collapse: collapse; border-spacing: 0; }

 

 

 

压缩版本:reset-min.css

 

代码
/*
Copyright 2010, KISSY UI Library v1.0.5
MIT Licensed
build: 524 Apr 6 09:10
*/
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td
{margin:0;padding:0;}body,button,input,select,textarea{font:12px/1.5 tahoma,arial,\5b8b\4f53,sans-serif;}h1,h2,h3,h4,h5,h6{font-size:100%;}address,cite,dfn,em,var{font-style:normal;}code,kbd,pre,samp{font-family:courier new,courier,monospace;}small{font-size:12px;}ul,ol{list-style:none;}a{text-decoration:none;}a:hover{text-decoration:underline;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}legend{color:#000;}fieldset,img{border:0;}button,input,select,textarea{font-size:100%;}table{border-collapse:collapse;border-spacing:0;}

 

测试页面:test.html

更新说明:

  1. 调整了字体和行高,请参见 三谈 Web 默认字体
  2. 将 h1 到 h3 的默认字号调整为 font-size: 100%;
  3. 去掉了 tt, abbr, hr, q 的重置样式。原因是:tt, q 不推荐使用。hr 的差异,具体页面去负责。abbr 的默认样式在各浏览器下虽然有差异,但并不会带来问题,重置意义不大。
  4. 加入了对 sup, sub 的重置样式。
  5. 增加了 reset-post.css, 方便重置以大段文字展示为主的内容区块。测试页面:test-post.html
代码
/*
KISSY CSS Reset for Post Content
适用:以大段文字展示为主的内容区块
维护:玉伯(lifesinger@gmail.com)
*/

/* require(reset.css) */

.ks-post
{
/* big font make content more readable */
font
: 14px/1.8 verdana,tahoma,arial,sans-serif;
}
.ks-post blockquote, .ks-post ul, .ks-post ol, .ks-post dl
{
/* giving blockquotes and lists room to breath */
margin
: 1em;
}
.ks-post ul, .ks-post ol, .ks-post dl
{
/* bringing lists on to the page with breathing room */
margin-left
: 2em;
}
.ks-post ol li
{
/* giving OL's LIs generated numbers */
list-style
: decimal outside;
}
.ks-post ul li
{
/* giving UL's LIs generated disc markers */
list-style
: disc outside;
}
.ks-post dl dd
{
/* providing spacing for definition terms */
margin-left
: 1em;
}
.ks-post th, .ks-post td
{
/* padding to make the table readable */
padding
: .5em;
}
.ks-post caption
{
/* coordinated margin to match cell's padding */
margin-bottom
: .5em;
}
.ks-post p, .ks-post fieldset, .ks-post table, .ks-post pre
{
/* so things don't run into each other */
margin-bottom
: 1em;
}

 

posted on 2010-05-26 23:11  Ephraim  阅读(1371)  评论(0编辑  收藏  举报