diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/README.md b/README.md index 80e3872..32bc276 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,11 @@ 目标:一致化浏览器排版效果,构建最适合中文阅读的网页排版。包括桌面和移动平台。 -预览:[typo.css](http://typo.sofish.de) +预览:[typo.css](http://typo.sofi.sh) ### 一、目录结构 . ├── README.md --- 使用帮助 - ├── TODO.md --- TODO-List ├── license.txt --- 许可证 ├── typo.css --- 将应用于你的项目 └── typo.html --- Demo/预览 @@ -15,7 +14,8 @@ ### 二、TYPO.CSS 的设计和使用 -建议看源代码,特别是注释,需要认真看。`typo.css` 主要包括: + +## TYPO.CSS 主要包括: 1、一般 reset.css 所需的内容 @@ -23,7 +23,9 @@ 2、`class="typo"` 阅读内容排版 -在文章/文档阅读的页面,需添加 `.typo` 这个 class,这样 table/ol/ul 等都会有预定的样式,让你的排版像 [http://typo.sofish.de]() 一样,让用户阅读起来更舒服。 +在文章/文档阅读的页面,需添加 `.typo` 这个 class,这样 table/ol/ul 等都会有预定的样式,让你的排版像 [http://typo.sofi.sh](http://typo.sofi.sh) 一样,让用户阅读起来更舒服。 + +在父容器在没有添加 `class="typo"` 的时候,可以使用 `class="typo-标签"`(如 `class="typo-ul"`)来实现像 `.typo > ul` 这样结构的样式。 3、增加类: @@ -31,14 +33,11 @@ (1) 专名号:使用标签 `` 或者 `.typo-u`
(2) 着重号:使用 class `.typo-em`
-(3) 首字下沉:使用 class `.typo-first`
-(4) 清理浮动:与一般 reset.css 保持一致 `.clearfix` - +(3) 清理浮动:与一般 reset.css 保持一致 `.clearfix`
+(4) 强制换行:添加 `.textwrap` 到文本所在的容器,如果是 `table` 测还需要 `.textwrap-table`
+(5) 衬线字体:添加 `.serif`
+(6) 创建 border-box:在 html 中添加 `.borderbox` [#why](http://www.paulirish.com/2012/box-sizing-border-box-ftw/) -### 三、开源许可 - -[Sofish Lin](http://sofish.de): founder, creator of [Alice CSS](http://aliceui.com), a code writter, a semi-designer.
-[Hotoo](https://github.com/hotoo): developer, VIM guru, front-end web developer @ alipay.com +### 三、开源许可 基于 [MIT License](http://zh.wikipedia.org/wiki/MIT_License) 开源,使用代码只需说明来源,或者引用 [license.txt](https://github.com/sofish/typo.css/blob/master/license.txt) 即可。 - diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 9cb1d7e..0000000 --- a/TODO.md +++ /dev/null @@ -1,11 +0,0 @@ -- typo-em:着重号实现 -- typo-first: 首字下沉实现 -- 全局与 `typo` 的完整 demo 示例 -- 根据 `附录一` 做兼容性测试 -- IE 的 `sup` 和 `sub` 显示问题 -- radio / checkbox 居中测试 -- input 多余空白增强类 -- 示例三 -- getting start 文档 -- 参与开发文档 -- moblie 平台的测试 \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index ae46020..0000000 --- a/index.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - TYPO.CSS - 中文网页重设与排版 - - - - -
- -

中文网页重设与排版:TYPO.CSS


-

一致化浏览器排版效果,构建最适合中文阅读的网页排版

- -
    -
  1. 关于 TYPO.CSS
  2. -
  3. 排版实例 - -
  4. -
  5. 附录 -
      -
    1. TYPO.CSS 排版偏重点
    2. -
    3. 开源许可
    4. -
    -
  6. -
- -

一、关于 TYPO.CSS

-

TYPO.CSS 的目的是,在一致化浏览器排版效果的同时,构建最适合中文阅读的网页排版。

-

现状和如何去做:

-

排版是一个麻烦的问题,需要精心设计,而这个设计却是常被视觉设计师所忽略的。前端工程师更常看到这样的问题,但不便变更。因为在多个 OS 中的不同浏览器渲染不同,改动需要多的时间做回归测试,所以改变变得更困难。而像我们一般使用的 Yahoo、Eric Meyer 和 Alice base.css 中采用的 Reset 都没有很好地考虑中文排版。TYPO.CSS 要做的就是解决中文排版的问题。

-

TYPO.CSS 测试于如下平台:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OS/浏览器FirefoxChromeSafariOperaIE9IE8IE7IE6
Mac OS X----
Windows 7-
Windows XP-
Ubuntu Linux-----
- -

中文排版的重点和难点

-

在中文排版中,HTML4 的很多标准在语义在都有照顾到。但从视觉效果上,却很难利用单独的 CSS 来实现,像着重号。在 HTML4 中,着重号标签(<u>)已经被放弃,而 HTML5 被重新提起。TYPO.CSS 也根据实际情况提供相应的方案。我们重要要注意的两点是:

-
    -
  1. 语义:语义对应的用法和样式是否与中文排版一致
  2. -
  3. 表现:在各浏览器中的字体、大小和缩放是否如排版预期
  4. -
-

对于这些,TYPO.CSS 排版项目的中文偏重注意点,都添加在附录中,详见:

-
- 附录一TYPO.CSS 排版偏重点 -
- -

目前仍处于 alpha 开发阶段,测试平台的覆盖,特别是在移动端上还没有覆盖完主流平台,希望有能力的同学能加入测试行列,或者加入到 TYPO.CSS 的开发。加入方法:参与 TYPO.CSS 开发。如有批评、建议和意见,也随时欢迎给在 Github 直接提 issues,或给邮件

- - -

二、排版实例:

-

提供2个排版实例,第一个中文实例来自于来自于张燕婴的《论语》,由于古文排版涉及到的元素比较多,所以采用《论语》中《学而》的第一篇作为排版实例介绍;第2个来自到经典的 Lorem Ipsum,并加入了一些代码和列表等比较具有代表性的排版元素。

- -

例1:论语学而篇第一

-

作者:孔子

- -

本篇引语

-

《学而》是《论语》第一篇的篇名。《论语》中各篇一般都是以第一章的前二三个字作为该篇的篇名。《学而》一篇包括16章,内容涉及诸多方面。其中重点是“吾日三省吾身”;“节用而爱人,使民以时”;“礼之用,和为贵”以及仁、孝、信等道德范畴。

- -

原文

-

子曰[1]:“学[2]而时习[3]之,不亦说[4]乎?有朋[5]自远方来,不亦乐[6]乎?人不知[7],而不愠[8],不亦君子[9]乎?”

- -

注释

-

- -[1] 子:中国古代对于有地位、有学问的男子的尊称,有时也泛称男子。《论语》书中“子曰”的子,都是指孔子而言。
-[2] 学:孔子在这里所讲的“学”,主要是指学习西周的礼、乐、诗、书等传统文化典籍。
-[3] 时习:在周秦时代,“时”字用作副词,意为“在一定的时候”或者“在适当的时候”。但朱熹在《论语集注》一书中把“时”解释为“时常”。“习”,指演习礼、乐;复习诗、书。也含有温习、实习、练习的意思。
-[4] 说:音yuè,同悦,愉快、高兴的意思。
-[5] 有朋:一本作“友朋”。旧注说,“同门曰朋”,即同在一位老师门下学习的叫朋,也就是志同道合的人。
-[6] 乐:与说有所区别。旧注说,悦在内心,乐则见于外。
-[7] 人不知:此句不完整,没有说出人不知道什么。缺少宾语。一般而言,知,是了解的意思。人不知,是说别人不了解自己。
-[8] 愠:音yùn,恼怒,怨恨。
-[9] 君子:《论语》书中的君子,有时指有德者,有时指有位者。此处指孔子理想中具有高尚人格的人。 -
-

- -

译文

-

孔子说:“学了又时常温习和练习,不是很愉快吗?有志同道合的人从远方来,不是很令人高兴的吗?人家不了解我,我也不怨恨、恼怒,不也是一个有德的君子吗?”

- -

评析

-

宋代著名学者朱熹对此章评价极高,说它是“入道之门,积德之基”。本章这三句话是人们非常熟悉的。历来的解释都是:学了以后,又时常温习和练习,不也高兴吗等等。三句话,一句一个意思,前后句子也没有什么连贯性。但也有人认为这样解释不符合原义,指出这里的“学”不是指学习,而是指学说或主张;“时”不能解为时常,而是时代或社会的意思,“习”不是温习,而是使用,引申为采用。而且,这三句话不是孤立的,而是前后相互连贯的。这三句的意思是:自己的学说,要是被社会采用了,那就太高兴了;退一步说,要是没有被社会所采用,可是很多朋友赞同的学说,纷纷到我这里来讨论问题,我也感到快乐;再退一步说,即使社会不采用,人们也不理解我,我也不怨恨,这样做,不也就是君子吗?(见《齐鲁学刊》1986年第6期文)这种解释可以自圆其说,而且也有一定的道理,供读者在理解本章内容时参考。 -此外,在对“人不知,而不愠”一句的解释中,也有人认为,“人不知”的后面没有宾语,人家不知道什么呢?当时因为孔子有说话的特定环境,他不需要说出知道什么,别人就可以理解了,却给后人留下一个谜。有人说,这一句是接上一句说的,从远方来的朋友向我求教,我告诉他,他还不懂,我却不怨恨。这样,“人不知”就是“人家不知道我所讲述的”了。这样的解释似乎有些牵强。 -总之,本章提出以学习为乐事,做到人不知而不愠,反映出孔子学而不厌、诲人不倦、注重修养、严格要求自己的主张。这些思想主张在《论语》书中多处可见,有助于对第一章内容的深入了解。 -

- -

例2:英文排版

-

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

-
-"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit…" -
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…"
-
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…" -
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…"
-
-
- -

The standard Lorem Ipsum passage, used since the 1500s

-

"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

- -

Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC

-

"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"

- -

List style in action

- - -

You may want to create a perfect <hr /> line, despite the fact that there will never have one

-
-

La Racheforcauld said: "Few things are impossible in themselves; and it is often for want of will ,rather than of means, that man fails to succeed". You just need to follow the browser's behavior, and set a right margin to it。it will works nice as the demo you're watching now. The following code is the best way to render typo in Chinese:

-
-/* 标题应该更贴紧内容,并与其他块区分,margin 值要相应做优化 */
-h1,h2,h3,h4,h5,h6 {
-    line-height:1;font-family:Arial,sans-serif;margin:1.4em 0 0.8em;
-}
-h1{font-size:1.8em;}
-h2{font-size:1.6em;}
-h3{font-size:1.4em;}
-h4{font-size:1.2em;}
-h5,h6{font-size:1em;}
-
-/* 现代排版:保证块/段落之间的空白隔行 */
-.typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr{
-    margin:1em 0 0.6em;
-}
-
- -

三、附录

- -
1、TYPO.CSS 排版偏重点
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
类型语义标签注意点
基础标签标题h1h6全局不强制大小,.typo 中标题与其对应的内容应紧贴,并且有相应的大小设置
上、下标sup/sub保持与 MicroSoft Office Word 等程序的日常排版一致
引用blockquote显示/嵌套样式
缩写abbr是否都有下划线,鼠标 hover 是否为帮助手势
分割线hr显示的 paddingmargin正确
列表ul/ol/dl在全局没有 list-style,在 .typo 中对齐正确
定义列表dl全局 paddingmargin为0, .typo 中对齐正确
选项input[type=radio[, checkbox]]与其他 form 元素排版时是否居中
斜体i只设置一种斜体,让 emcite 显示为正体
强调em在全局显示正体,在 .typo 中显示与 bstrong 的样式一致,为粗休
加强strong/b显示为粗体
标记mark类似荧光笔
印刷small保持为正确字体的 80% 大小,颜色设置为浅灰色
表格table全局不显示线条,在 table 中显示表格外框,并且表头有浅灰背景
代码pre/code字体使用 courier 系字体,保持与 serif 有比较一致的显示效果
特殊符号着重号在文字下加点(•)在支持 :after:before 的浏览器可以做渐进增强实现
专名号林建锋专名号,有下划线,使用 u 或都 .typo-u
破折号——保持一划,而非两划
人民币¥使用两平等线的符号,或者 HTML 实体符号 &yen;
删除符已删除(deleted)一致化各浏览器显示,中英混排正确
加强类专名号.typo-u由于 u 被 HTML4 放弃,在向后兼容上推荐使用
着重符.typo-em利用 :after:before 实现着重符
首字下沉.typo-first特殊排版
清除浮动.clearfix与一般 CSS Reset 保持一对致 API
注意点(1)中英文混排行高/行距
(2)上下标在 IE 中显示效果
(3)块/段落分割空白是否符合设计原则
(4)input 多余空间问题
(5)默认字体色彩,目前采用 #333 在各种浏览显示比较好
- -
2、开源许可
-

TYPO.CSS 基于 MIT License 开源,使用代码只需说明来源,或者引用 license.txt 即可。

-
- - Fork me on GitHub - - - - diff --git a/package.json b/package.json new file mode 100644 index 0000000..832fa3b --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "typo.css", + "version": "2.1.2", + "description": "一致化浏览器排版效果,构建最适合中文阅读的网页排版", + "main": "typo.css", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/sofish/typo.css.git" + }, + "keywords": [ + "typograhpy", + "中文" + ], + "author": "sofish (http://sofi.sh/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/sofish/typo.css/issues" + }, + "homepage": "https://github.com/sofish/typo.css" +} diff --git a/typo.css b/typo.css index 41862e7..2373d75 100644 --- a/typo.css +++ b/typo.css @@ -2,250 +2,345 @@ /* 防止用户自定义背景颜色对网页的影响,添加让用户可以自定义字体 */ html { - color: #555; - background: #fff; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; + color: #333; + background: #fff; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + text-rendering: optimizelegibility; +} + +/* 如果你的项目仅支持 IE9+ | Chrome | Firefox 等,推荐在 中添加 .borderbox 这个 class */ +html.borderbox *, html.borderbox *:before, html.borderbox *:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; } /* 内外边距通常让各个浏览器样式的表现位置不同 */ -body, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, hr, button, article, aside, details, figcaption, figure, footer, header, group, menu, nav, section { - margin: 0; - padding: 0; +body, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, hr, button, article, aside, details, figcaption, figure, footer, header, menu, nav, section { + margin: 0; + padding: 0; } /* 重设 HTML5 标签, IE 需要在 js 中 createElement(TAG) */ -article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { - display: block; +article, aside, details, figcaption, figure, footer, header, menu, nav, section { + display: block; } /* HTML5 媒体文件跟 img 保持一致 */ audio, canvas, video { - display: inline-block; - *display: inline; - *zoom: 1; + display: inline-block; } /* 要注意表单元素并不继承父级 font 的问题 */ body, button, input, select, textarea { - font: 500 14px/1.8 'Hiragino Sans GB', sans-serif; + font: 300 1em/1.8 PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif; } -/* 去掉各Table cell 的边距并让其边重合 */ -table { - border-collapse: collapse; - border-spacing: 0; +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; } -/* IE bug fixed: th 不继承 text-align*/ -th { - text-align: inherit; +/* 去掉各Table cell 的边距并让其边重合 */ +table { + border-collapse: collapse; + border-spacing: 0; } /* 去除默认边框 */ fieldset, img { - border: 0; -} - -/* 解决 IE6-7 图片缩放锯齿问题 */ -img { - -ms-interpolation-mode: bicubic; -} - -/* ie6 7 8(q) bug 显示为行内表现 */ -iframe { - display: block; + border: 0; } /* 块/段落引用 */ blockquote { - margin: 1em 4em 1em 2em; - padding: 0.6em 1em; - background: #f1f1f1; + position: relative; + color: #999; + font-weight: 400; + border-left: 1px solid #1abc9c; + padding-left: 1em; + margin: 1em 3em 1em 2em; } -blockquote blockquote { - padding: 0 0 0 1em; - margin-left: 2em; - border-left: 0.4em solid #ddd; + +@media only screen and ( max-width: 640px ) { + blockquote { + margin: 1em 0; + } } /* Firefox 以外,元素没有下划线,需添加 */ acronym, abbr { - border-bottom: 1px dotted; - font-variant: normal; + border-bottom: 1px dotted; + font-variant: normal; + text-decoration: none; } /* 添加鼠标问号,进一步确保应用的语义是正确的(要知道,交互他们也有洁癖,如果你不去掉,那得多花点口舌) */ abbr { - cursor: help; + cursor: help; } /* 一致的 del 样式 */ del { - text-decoration: line-through; + text-decoration: line-through; } -address, caption, cite, code, den, em, th, var { - font-style: normal; - font-weight: 500; +address, caption, cite, code, dfn, em, th, var { + font-style: normal; + font-weight: 400; } /* 去掉列表前的标识, li 会继承,大部分网站通常用列表来很多内容,所以应该当去 */ ul, ol { - list-style: none; + list-style: none; } /* 对齐是排版最重要的因素, 别让什么都居中 */ caption, th { - text-align: left; + text-align: left; } q:before, q:after { - content: ''; + content: ''; } /* 统一上标和下标 */ sub, sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: text-top\9; + font-size: 75%; + line-height: 0; + position: relative; } -:root sub, :root sup{ - vertical-align: baseline; /* for ie9 and other mordern browsers */ + +:root sub, :root sup { + vertical-align: baseline; /* for ie9 and other modern browsers */ } + sup { - top: -0.5em; + top: -0.5em; } + sub { - bottom: -0.25em; + bottom: -0.25em; } /* 让链接在 hover 状态下显示下划线 */ +a { + color: #1abc9c; +} + a:hover { - text-decoration: underline; + text-decoration: underline; +} + +.typo a { + border-bottom: 1px solid #1abc9c; +} + +.typo a:hover { + border-bottom-color: #555; + color: #555; + text-decoration: none; } /* 默认不显示下划线,保持页面简洁 */ ins, a { - text-decoration: none; + text-decoration: none; } /* 专名号:虽然 u 已经重回 html5 Draft,但在所有浏览器中都是可以使用的, * 要做到更好,向后兼容的话,添加 class="typo-u" 来显示专名号 * 关于 标签:http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-u-element * 被放弃的是 4,之前一直搞错 http://www.w3.org/TR/html401/appendix/changes.html#idx-deprecated - * 一篇关于 标签的很好文章:http://html5doctor.com/u-element/ + * 一篇关于 标签的很好文章:http://html5doctor.com/u-element/ */ u, .typo-u { - text-decoration: underline; + text-decoration: underline; } /* 标记,类似于手写的荧光笔的作用 */ mark { - background: #fffdd1; + background: #fffdd1; + border-bottom: 1px solid #ffedce; + padding: 2px; + margin: 0 5px; } /* 代码片断 */ -pre, code { - font-family: "Courier New", Courier, monospace; +pre, code, pre tt { + font-family: Courier, 'Courier New', monospace; } + pre { - border: 1px solid #ddd; - border-left-width: 0.4em; - background: #fbfbfb; - padding: 10px; + background: #f8f8f8; + border: 1px solid #ddd; + padding: 1em 1.5em; + display: block; + -webkit-overflow-scrolling: touch; +} + +/* 一致化 horizontal rule */ +hr { + border: none; + border-bottom: 1px solid #cfcfcf; + margin-bottom: 0.8em; + height: 10px; } /* 底部印刷体、版本等标记 */ -small { - font-size: 12px; - color: #888; +small, .typo-small, + /* 图片说明 */ +figcaption { + font-size: 0.9em; + color: #888; +} + +strong, b { + font-weight: bold; + color: #000; +} + +/* 可拖动文件添加拖动手势 */ +[draggable] { + cursor: move; } .clearfix:before, .clearfix:after { - content: ""; - display: table; + content: ""; + display: table; } .clearfix:after { - clear: both + clear: both; } .clearfix { - zoom: 1 + zoom: 1; +} + +/* 强制文本换行 */ +.textwrap, .textwrap td, .textwrap th { + word-wrap: break-word; + word-break: break-all; +} + +.textwrap-table { + table-layout: fixed; +} + +/* 提供 serif 版本的字体设置: iOS 下中文自动 fallback 到 sans-serif */ +.serif { + font-family: Palatino, Optima, Georgia, serif; } /* 保证块/段落之间的空白隔行 */ .typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr, .typo table, -.typo-p, .typo-pre, .typo-ul, .typo-ol, .typo-dl, .typo-form, .typo-hr, .typo-table { - margin-bottom: 1em; +.typo-p, .typo-pre, .typo-ul, .typo-ol, .typo-dl, .typo-form, .typo-hr, .typo-table, blockquote { + margin-bottom: 1.2em } -h1, h2, h3, h4, h5, h6{ - font-weight: 500; - font-weight: 800\9; - color:#333; +h1, h2, h3, h4, h5, h6 { + font-family: PingFang SC, Verdana, Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif; + font-weight: 100; + color: #000; + line-height: 1.35; } /* 标题应该更贴紧内容,并与其他块区分,margin 值要相应做优化 */ .typo h1, .typo h2, .typo h3, .typo h4, .typo h5, .typo h6, .typo-h1, .typo-h2, .typo-h3, .typo-h4, .typo-h5, .typo-h6 { - margin-bottom: 0.4em; - line-height: 1.5; + margin-top: 1.2em; + margin-bottom: 0.6em; + line-height: 1.35; } + .typo h1, .typo-h1 { - font-size: 1.8em; + font-size: 2em; } + .typo h2, .typo-h2 { - font-size: 1.6em; + font-size: 1.8em; } + .typo h3, .typo-h3 { - font-size: 1.4em; + font-size: 1.6em; } + .typo h4, .typo-h4 { - font-size: 1.2em; + font-size: 1.4em; } + .typo h5, .typo h6, .typo-h5, .typo-h6 { - font-size: 1em; + font-size: 1.2em; } /* 在文章中,应该还原 ul 和 ol 的样式 */ .typo ul, .typo-ul { - margin-left: 1.3em; - list-style: disc; + margin-left: 1.3em; + list-style: disc; } + .typo ol, .typo-ol { - list-style: decimal; - margin-left: 1.9em; + list-style: decimal; + margin-left: 1.9em; } + .typo li ul, .typo li ol, .typo-ul ul, .typo-ul ol, .typo-ol ul, .typo-ol ol { - margin-top: 0; - margin-bottom: 0; - margin-left: 2em; + margin-bottom: 0.8em; + margin-left: 2em; } + .typo li ul, .typo-ul ul, .typo-ol ul { - list-style: circle; + list-style: circle; } /* 同 ul/ol,在文章中应用 table 基本格式 */ -.typo table th, .typo table td, .typo-table th, .typo-table td { - border: 1px solid #ddd; - padding: 5px 10px; +.typo table th, .typo table td, .typo-table th, .typo-table td, .typo table caption { + border: 1px solid #ddd; + padding: 0.5em 1em; + color: #666; } + .typo table th, .typo-table th { - background: #fbfbfb; + background: #fbfbfb; } + .typo table thead th, .typo-table thead th { - background: #f1f1f1; + background: #f1f1f1; +} + +.typo table caption { + border-bottom: none; +} + +/* 去除 webkit 中 input 和 textarea 的默认样式 */ +.typo-input, .typo-textarea { + -webkit-appearance: none; + border-radius: 0; } -/* TODO: 供着重号使用 */ -.typo-em, .typo em { - font-weight: 700; +.typo-em, .typo em, legend, caption { + color: #000; + font-weight: inherit; } -/* TODO: 供首字下沉使用 */ -.typo-first{ +/* 着重号,只能在少量(少于100个字符)且全是全角字符的情况下使用 */ +.typo-em { + position: relative; +} + +.typo-em:after { + position: absolute; + top: 0.65em; + left: 0; + width: 100%; + overflow: hidden; + white-space: nowrap; + content: "・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・"; +} +/* Responsive images */ +.typo img { + max-width: 100%; } diff --git a/typo.html b/typo.html index ebc6f84..9a19c17 100644 --- a/typo.html +++ b/typo.html @@ -1,191 +1,252 @@ - - - - TYPO.CSS - 中文网页重设与排版 - + + + + + Typo.css - 中文网页重设与排版 + -
+
+ + +
-

中文网页重设与排版:TYPO.CSS


-

一致化浏览器排版效果,构建最适合中文阅读的网页排版

+
-
    -
  1. 关于 TYPO.CSS
  2. -
  3. 排版实例 - -
  4. -
  5. 附录 -
      -
    1. TYPO.CSS 排版偏重点
    2. -
    3. 开源许可
    4. -
    -
  6. +

    中文网页重设与排版:Typo.css


    + +

    一致化浏览器排版效果,构建最适合中文阅读的网页排版

    + +
      +
    1. 关于 Typo.css
    2. +
    3. 排版实例 + +
    4. +
    5. 附录 + +
    -

    一、关于 TYPO.CSS

    -

    TYPO.CSS 的目的是,在一致化浏览器排版效果的同时,构建最适合中文阅读的网页排版。

    +

    一、关于 Typo.css

    + +

    Typo.css 的目的是,在一致化浏览器排版效果的同时,构建最适合中文阅读的网页排版。

    现状和如何去做:

    -

    排版是一个麻烦的问题,需要精心设计,而这个设计却是常被视觉设计师所忽略的。前端工程师更常看到这样的问题,但不便变更。因为在多个 OS 中的不同浏览器渲染不同,改动需要多的时间做回归测试,所以改变变得更困难。而像我们一般使用的 Yahoo、Eric Meyer 和 Alice base.css 中采用的 Reset 都没有很好地考虑中文排版。TYPO.CSS 要做的就是解决中文排版的问题。

    -

    TYPO.CSS 测试于如下平台:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +

    排版是一个麻烦的问题 # 附录一,需要精心设计,而这个设计却是常被视觉设计师所忽略的。前端工程师更常看到这样的问题,但不便变更。因为在多个 OS 中的不同浏览器渲染不同,改动需要多的时间做回归测试,所以改变变得更困难。而像我们一般使用的 + Yahoo、Eric Meyer 和 Alice base.css 中采用的 Reset 都没有很好地考虑中文排版。Typo.css 要做的就是解决中文排版的问题。

    + +

    Typo.css 测试于如下平台:

    +
    OS/浏览器FirefoxChromeSafariOperaIE9IE8IE7IE6
    Mac OS X----
    Windows 7-
    Windows XP-
    Ubuntu Linux-----
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OS/浏览器FirefoxChromeSafariOperaIE9IE8IE7IE6
    OS X----
    Win 7-
    Win XP-
    Ubuntu-----

    中文排版的重点和难点

    -

    在中文排版中,HTML4 的很多标准在语义在都有照顾到。但从视觉效果上,却很难利用单独的 CSS 来实现,像着重号。在 HTML4 中,着重号标签(<u>)已经被放弃,而 HTML5 被重新提起。TYPO.CSS 也根据实际情况提供相应的方案。我们重要要注意的两点是:

    + +

    在中文排版中,HTML4 的很多标准在语义在都有照顾到。但从视觉效果上,却很难利用单独的 CSS 来实现,像着重号(例:这里强调一下)。在 HTML4 中,专名号标签(<u>)已经被放弃,而 + HTML5 被重新提起Typo.css 也根据实际情况提供相应的方案。我们重要要注意的两点是:

      -
    1. 语义:语义对应的用法和样式是否与中文排版一致
    2. -
    3. 表现:在各浏览器中的字体、大小和缩放是否如排版预期
    4. +
    5. 语义:语义对应的用法和样式是否与中文排版一致
    6. +
    7. 表现:在各浏览器中的字体、大小和缩放是否如排版预期
    -

    对于这些,TYPO.CSS 排版项目的中文偏重注意点,都添加在附录中,详见:

    +

    对于这些,Typo.css 排版项目的中文偏重注意点,都添加在附录中,详见:

    - 附录一TYPO.CSS 排版偏重点 + 附录一Typo.css 排版偏重点
    -

    目前仍处于 alpha 开发阶段,测试平台的覆盖,特别是在移动端上还没有覆盖完主流平台,希望有能力的同学能加入测试行列,或者加入到 TYPO.CSS 的开发。加入方法:参与 TYPO.CSS 开发。如有批评、建议和意见,也随时欢迎给在 Github 直接提 issues,或给邮件

    +

    目前已有像百姓网等全面使用 Typo.css 的项目,测试平台的覆盖,特别是在移动端上还没有覆盖完主流平台,希望有能力的同学能加入测试行列,或者加入到 Typo.css + 的开发。加入方法:参与 Typo.css 开发。如有批评、建议和意见,也随时欢迎给在 Github 直接提 issues,或给邮件

    二、排版实例:

    -

    提供2个排版实例,第一个中文实例来自于来自于张燕婴的《论语》,由于古文排版涉及到的元素比较多,所以采用《论语》中《学而》的第一篇作为排版实例介绍;第2个来自到经典的 Lorem Ipsum,并加入了一些代码和列表等比较具有代表性的排版元素。

    + +

    提供2个排版实例,第一个中文实例来自于来自于张燕婴的《论语》,由于古文排版涉及到的元素比较多,所以采用《论语》中《学而》的第一篇作为排版实例介绍;第2个来自到经典的 + Lorem Ipsum,并加入了一些代码和列表等比较具有代表性的排版元素。

    例1:论语学而篇第一

    -

    作者:孔子

    -

    本篇引语

    -

    《学而》是《论语》第一篇的篇名。《论语》中各篇一般都是以第一章的前二三个字作为该篇的篇名。《学而》一篇包括16章,内容涉及诸多方面。其中重点是“吾日三省吾身”;“节用而爱人,使民以时”;“礼之用,和为贵”以及仁、孝、信等道德范畴。

    +

    + 作者:孔子( + + ) + +

    -

    原文

    -

    子曰[1]:“学[2]而时习[3]之,不亦说[4]乎?有朋[5]自远方来,不亦乐[6]乎?人不知[7],而不愠[8],不亦君子[9]乎?”

    +

    本篇引语

    -

    注释

    - -[1] 子:中国古代对于有地位、有学问的男子的尊称,有时也泛称男子。《论语》书中“子曰”的子,都是指孔子而言。
    -[2] 学:孔子在这里所讲的“学”,主要是指学习西周的礼、乐、诗、书等传统文化典籍。
    -[3] 时习:在周秦时代,“时”字用作副词,意为“在一定的时候”或者“在适当的时候”。但朱熹在《论语集注》一书中把“时”解释为“时常”。“习”,指演习礼、乐;复习诗、书。也含有温习、实习、练习的意思。
    -[4] 说:音yuè,同悦,愉快、高兴的意思。
    -[5] 有朋:一本作“友朋”。旧注说,“同门曰朋”,即同在一位老师门下学习的叫朋,也就是志同道合的人。
    -[6] 乐:与说有所区别。旧注说,悦在内心,乐则见于外。
    -[7] 人不知:此句不完整,没有说出人不知道什么。缺少宾语。一般而言,知,是了解的意思。人不知,是说别人不了解自己。
    -[8] 愠:音yùn,恼怒,怨恨。
    -[9] 君子:《论语》书中的君子,有时指有德者,有时指有位者。此处指孔子理想中具有高尚人格的人。 -
    -

    + 《学而》是《论语》第一篇的篇名。《论语》中各篇一般都是以第一章的前二三个字作为该篇的篇名。《学而》一篇包括16章,内容涉及诸多方面。其中重点是「吾日三省吾身」;「节用而爱人,使民以时」;「礼之用,和为贵」以及仁、孝、信等道德范畴。

    + +

    原文

    + +

    子曰:「学而时习之,不亦说乎?有朋自远方来,不亦乐乎?人不知,而不愠,不亦君子乎?」

    译文

    -

    孔子说:“学了又时常温习和练习,不是很愉快吗?有志同道合的人从远方来,不是很令人高兴的吗?人家不了解我,我也不怨恨、恼怒,不也是一个有德的君子吗?”

    -

    评析

    -

    宋代著名学者朱熹对此章评价极高,说它是“入道之门,积德之基”。本章这三句话是人们非常熟悉的。历来的解释都是:学了以后,又时常温习和练习,不也高兴吗等等。三句话,一句一个意思,前后句子也没有什么连贯性。但也有人认为这样解释不符合原义,指出这里的“学”不是指学习,而是指学说或主张;“时”不能解为时常,而是时代或社会的意思,“习”不是温习,而是使用,引申为采用。而且,这三句话不是孤立的,而是前后相互连贯的。这三句的意思是:自己的学说,要是被社会采用了,那就太高兴了;退一步说,要是没有被社会所采用,可是很多朋友赞同的学说,纷纷到我这里来讨论问题,我也感到快乐;再退一步说,即使社会不采用,人们也不理解我,我也不怨恨,这样做,不也就是君子吗?(见《齐鲁学刊》1986年第6期文)这种解释可以自圆其说,而且也有一定的道理,供读者在理解本章内容时参考。 -此外,在对“人不知,而不愠”一句的解释中,也有人认为,“人不知”的后面没有宾语,人家不知道什么呢?当时因为孔子有说话的特定环境,他不需要说出知道什么,别人就可以理解了,却给后人留下一个谜。有人说,这一句是接上一句说的,从远方来的朋友向我求教,我告诉他,他还不懂,我却不怨恨。这样,“人不知”就是“人家不知道我所讲述的”了。这样的解释似乎有些牵强。 -总之,本章提出以学习为乐事,做到人不知而不愠,反映出孔子学而不厌、诲人不倦、注重修养、严格要求自己的主张。这些思想主张在《论语》书中多处可见,有助于对第一章内容的深入了解。 +

    孔子说:「学了又时常温习和练习,不是很愉快吗?有志同道合的人从远方来,不是很令人高兴的吗?人家不了解我,我也不怨恨、恼怒,不也是一个有德的君子吗?」

    + +

    评析

    + +

    宋代著名学者朱熹对此章评价极高,说它是「入道之门,积德之基」。本章这三句话是人们非常熟悉的。历来的解释都是:学了以后,又时常温习和练习,不也高兴吗等等。三句话,一句一个意思,前后句子也没有什么连贯性。但也有人认为这样解释不符合原义,指出这里的「学」不是指学习,而是指学说或主张;「时」不能解为时常,而是时代或社会的意思,「习」不是温习,而是使用,引申为采用。而且,这三句话不是孤立的,而是前后相互连贯的。这三句的意思是:自己的学说,要是被社会采用了,那就太高兴了;退一步说,要是没有被社会所采用,可是很多朋友赞同的学说,纷纷到我这里来讨论问题,我也感到快乐;再退一步说,即使社会不采用,人们也不理解我,我也不怨恨,这样做,不也就是君子吗?(见《齐鲁学刊》1986年第6期文)这种解释可以自圆其说,而且也有一定的道理,供读者在理解本章内容时参考。

    +

    此外,在对「人不知,而不愠」一句的解释中,也有人认为,「人不知」的后面没有宾语,人家不知道什么呢?当时因为孔子有说话的特定环境,他不需要说出知道什么,别人就可以理解了,却给后人留下一个谜。有人说,这一句是接上一句说的,从远方来的朋友向我求教,我告诉他,他还不懂,我却不怨恨。这样,「人不知」就是「人家不知道我所讲述的」了。这样的解释似乎有些牵强。

    + +

    总之,本章提出以学习为乐事,做到人不知而不愠,反映出孔子学而不厌、诲人不倦、注重修养、严格要求自己的主张。这些思想主张在《论语》书中多处可见,有助于对第一章内容的深入了解。

    +

    例2:英文排版

    -

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    + +

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's + standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a + type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining + essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum + passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem + Ipsum.

    -"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit…" -
    "There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…"
    -
    "There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…" -
    "There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…"
    -
    + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

    The standard Lorem Ipsum passage, used since the 1500s

    -

    "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

    + +

    "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

    Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC

    -

    "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"

    + +

    "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, + eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam + voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione + voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci + velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim + ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi + consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, + vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"

    List style in action

      -
    • If you wish to succeed, you should use persistence as your good friend, experience as your reference, prudence as your brother and hope as your sentry. -

      如果你希望成功,当以恒心为良友,以经验为参谋,以谨慎为兄弟,以希望为哨兵。

      -
    • -
    • Sometimes one pays most for the things one gets for nothing. -

      有时候一个人为不花钱得到的东西付出的代价最高。

      -
    • -
    • Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily. -

      只有有耐心圆满完成简单工作的人,才能够轻而易举的完成困难的事。

      -
    • +
    • If you wish to succeed, you should use persistence as your good friend, experience as your reference, prudence as + your brother and hope as your sentry. +

      如果你希望成功,当以恒心为良友,以经验为参谋,以谨慎为兄弟,以希望为哨兵。

      +
    • +
    • Sometimes one pays most for the things one gets for nothing. +

      有时候一个人为不花钱得到的东西付出的代价最高。

      +
    • +
    • Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things + easily. +

      只有有耐心圆满完成简单工作的人,才能够轻而易举的完成困难的事。

      +
    -

    You may want to create a perfect <hr /> line, despite the fact that there will never have one

    -
    -

    La Racheforcauld said: "Few things are impossible in themselves; and it is often for want of will ,rather than of means, that man fails to succeed". You just need to follow the browser's behavior, and set a right margin to it。it will works nice as the demo you're watching now. The following code is the best way to render typo in Chinese:

    +

    You may want to create a perfect <hr /> line, despite the fact that there will never have one +

    +
    +

    La Racheforcauld said: + "Few things are impossible in themselves; and it is often for want of will, rather than of means, that man fails + to succeed". + + You just need to follow the browser's behavior, and set a right margin to it。it will works nice as the + demo you're watching now. The following code is the best way to render typo in Chinese: +

     /* 标题应该更贴紧内容,并与其他块区分,margin 值要相应做优化 */
     h1,h2,h3,h4,h5,h6 {
    @@ -198,171 +259,171 @@ 

    You may want to create a perfect <hr /> line, despite the h5,h6{font-size:1em;} /* 现代排版:保证块/段落之间的空白隔行 */ -.typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr{ +.typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr { margin:1em 0 0.6em; }

    三、附录

    -
    1、TYPO.CSS 排版偏重点
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    1、Typo.css 排版偏重点
    +
    类型语义标签注意点
    基础标签标题h1h6全局不强制大小,.typo 中标题与其对应的内容应紧贴,并且有相应的大小设置
    上、下标sup/sub保持与 MicroSoft Office Word 等程序的日常排版一致
    引用blockquote显示/嵌套样式
    缩写abbr是否都有下划线,鼠标 hover 是否为帮助手势
    分割线hr显示的 paddingmargin正确
    列表ul/ol/dl在全局没有 list-style,在 .typo 中对齐正确
    定义列表dl全局 paddingmargin为0, .typo 中对齐正确
    选项input[type=radio[, checkbox]]与其他 form 元素排版时是否居中
    斜体i只设置一种斜体,让 emcite 显示为正体
    强调em在全局显示正体,在 .typo 中显示与 bstrong 的样式一致,为粗休
    加强strong/b显示为粗体
    标记mark类似荧光笔
    印刷small保持为正确字体的 80% 大小,颜色设置为浅灰色
    表格table全局不显示线条,在 table 中显示表格外框,并且表头有浅灰背景
    代码pre/code字体使用 courier 系字体,保持与 serif 有比较一致的显示效果
    特殊符号着重号在文字下加点(•)在支持 :after:before 的浏览器可以做渐进增强实现
    专名号林建锋专名号,有下划线,使用 u 或都 .typo-u
    破折号——保持一划,而非两划
    人民币¥使用两平等线的符号,或者 HTML 实体符号 &yen;
    删除符已删除(deleted)一致化各浏览器显示,中英混排正确
    加强类专名号.typo-u由于 u 被 HTML4 放弃,在向后兼容上推荐使用
    着重符.typo-em利用 :after:before 实现着重符
    首字下沉.typo-first特殊排版
    清除浮动.clearfix与一般 CSS Reset 保持一对致 API
    注意点(1)中英文混排行高/行距
    (2)上下标在 IE 中显示效果
    (3)块/段落分割空白是否符合设计原则
    (4)input 多余空间问题
    (5)默认字体色彩,目前采用 #333 在各种浏览显示比较好
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    类型语义标签注意点
    基础标签标题h1h6全局不强制大小,.typo 中标题与其对应的内容应紧贴,并且有相应的大小设置
    上、下标sup/sub保持与 MicroSoft Office Word 等程序的日常排版一致
    引用blockquote显示/嵌套样式
    缩写abbr是否都有下划线,鼠标 hover 是否为帮助手势
    分割线hr显示的 paddingmargin正确
    列表ul/ol/dl在全局没有 list-style,在 .typo 中对齐正确
    定义列表dl全局 paddingmargin为0, .typo 中对齐正确
    选项input[type=radio[, checkbox]]与其他 form 元素排版时是否居中
    斜体i只设置一种斜体,让 emcite 显示为正体
    强调em在全局显示正体,在 .typo 中显示与 bstrong 的样式一致,为粗体
    加强strong/b显示为粗体
    标记mark类似荧光笔
    印刷small保持为正确字体的 80% 大小,颜色设置为浅灰色
    表格table全局不显示线条,在 table 中显示表格外框,并且表头有浅灰背景
    代码pre/code字体使用 courier 系字体,保持与 serif 有比较一致的显示效果
    特殊符号着重号在文字下加点在支持 :after:before 的浏览器可以做渐进增强实现
    专名号林建锋专名号,有下划线,使用 u 或都 .typo-u
    破折号——保持一划,而非两划
    人民币¥使用两平等线的符号,或者 HTML 实体符号 &yen;
    删除符 + 已删除(deleted) + 一致化各浏览器显示,中英混排正确
    加强类专名号.typo-u由于 u 被 HTML4 放弃,在向后兼容上推荐使用 .typo-u
    着重符.typo-em利用 :after:before 实现着重符
    清除浮动.clearfix与一般 CSS Reset 保持一对致 API
    注意点(1)中英文混排行高/行距
    (2)上下标在 IE 中显示效果
    (3)块/段落分割空白是否符合设计原则
    (4)input 多余空间问题
    (5)默认字体色彩,目前采用 #333 在各种浏览显示比较好
    2、开源许可
    -

    TYPO.CSS 基于 MIT License 开源,使用代码只需说明来源,或者引用 license.txt 即可。

    -
- - Fork me on GitHub + +

Typo.css 基于 MIT License 开源,使用代码只需说明来源,或者引用 license.txt 即可。

+
+ + + Fork me on GitHub