_typo.less 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. @charset "utf-8";
  2. .typo {
  3. font-size:1.6rem;
  4. @media (max-width: @on-phone) {
  5. padding: 0px 20px;
  6. }
  7. }
  8. /* 内外边距通常让各个浏览器样式的表现位置不同 */
  9. 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 {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. /* 重设 HTML5 标签, IE 需要在 js 中 createElement(TAG) */
  14. article, aside, details, figcaption, figure, footer, header, menu, nav, section {
  15. display: block;
  16. }
  17. /* HTML5 媒体文件跟 img 保持一致 */
  18. audio, canvas, video {
  19. display: inline-block;
  20. }
  21. /* 要注意表单元素并不继承父级 font 的问题 */
  22. body, button, input, select, textarea {
  23. font: 300 1em/1.8 PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans;
  24. }
  25. button::-moz-focus-inner,
  26. input::-moz-focus-inner {
  27. padding: 0;
  28. border: 0;
  29. }
  30. /* 去掉各Table cell 的边距并让其边重合 */
  31. table {
  32. border-collapse: collapse;
  33. border-spacing: 0;
  34. }
  35. /* 去除默认边框 */
  36. fieldset, img {
  37. border: 0;
  38. }
  39. /* 块/段落引用 */
  40. blockquote {
  41. position: relative;
  42. color: #999;
  43. font-weight: 400;
  44. border-left: 1px solid #1abc9c;
  45. padding-left: 1em;
  46. margin: 1em 3em 1em 2em;
  47. }
  48. @media only screen and ( max-width: 640px ) {
  49. blockquote {
  50. margin: 1em 0;
  51. }
  52. }
  53. /* Firefox 以外,元素没有下划线,需添加 */
  54. acronym, abbr {
  55. border-bottom: 1px dotted;
  56. font-variant: normal;
  57. }
  58. /* 添加鼠标问号,进一步确保应用的语义是正确的(要知道,交互他们也有洁癖,如果你不去掉,那得多花点口舌) */
  59. abbr {
  60. cursor: help;
  61. }
  62. /* 一致的 del 样式 */
  63. del {
  64. text-decoration: line-through;
  65. }
  66. address, caption, cite, code, dfn, em, th, var {
  67. font-style: normal;
  68. font-weight: 400;
  69. }
  70. /* 去掉列表前的标识, li 会继承,大部分网站通常用列表来很多内容,所以应该当去 */
  71. ul, ol {
  72. list-style: none;
  73. }
  74. /* 对齐是排版最重要的因素, 别让什么都居中 */
  75. caption, th {
  76. text-align: left;
  77. }
  78. q:before, q:after {
  79. content: '';
  80. }
  81. /* 统一上标和下标 */
  82. sub, sup {
  83. font-size: 75%;
  84. line-height: 0;
  85. position: relative;
  86. }
  87. :root sub, :root sup {
  88. vertical-align: baseline; /* for ie9 and other modern browsers */
  89. }
  90. sup {
  91. top: -0.5em;
  92. }
  93. sub {
  94. bottom: -0.25em;
  95. }
  96. /* 让链接在 hover 状态下显示下划线 */
  97. a {
  98. color: #1abc9c;
  99. }
  100. a:hover {
  101. text-decoration: underline;
  102. }
  103. .typo a {
  104. border-bottom: 1px solid #1abc9c;
  105. }
  106. .typo a:hover {
  107. border-bottom-color: #555;
  108. color: #555;
  109. text-decoration: none;
  110. }
  111. /* 默认不显示下划线,保持页面简洁 */
  112. ins, a {
  113. text-decoration: none;
  114. }
  115. /* 专名号:虽然 u 已经重回 html5 Draft,但在所有浏览器中都是可以使用的,
  116. * 要做到更好,向后兼容的话,添加 class="typo-u" 来显示专名号
  117. * 关于 <u> 标签:http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-u-element
  118. * 被放弃的是 4,之前一直搞错 http://www.w3.org/TR/html401/appendix/changes.html#idx-deprecated
  119. * 一篇关于 <u> 标签的很好文章:http://html5doctor.com/u-element/
  120. */
  121. u, .typo-u {
  122. text-decoration: underline;
  123. }
  124. /* 标记,类似于手写的荧光笔的作用 */
  125. mark {
  126. background: #fffdd1;
  127. border-bottom: 1px solid #ffedce;
  128. padding: 2px;
  129. margin: 0 5px;
  130. }
  131. /* 代码片断 */
  132. pre, code, pre tt {
  133. font-family: Courier, 'Courier New', monospace;
  134. }
  135. pre {
  136. background: #f8f8f8;
  137. border: 1px solid #ddd;
  138. padding: 1em 1.5em;
  139. display: block;
  140. -webkit-overflow-scrolling: touch;
  141. }
  142. /* 一致化 horizontal rule */
  143. hr {
  144. border: none;
  145. border-bottom: 1px solid #cfcfcf;
  146. margin-bottom: 0.8em;
  147. height: 10px;
  148. }
  149. /* 底部印刷体、版本等标记 */
  150. small, .typo-small,
  151. /* 图片说明 */
  152. figcaption {
  153. font-size: 0.9em;
  154. color: #888;
  155. }
  156. strong, b {
  157. font-weight: bold;
  158. color: #000;
  159. }
  160. /* 可拖动文件添加拖动手势 */
  161. [draggable] {
  162. cursor: move;
  163. }
  164. .clearfix:before, .clearfix:after {
  165. content: "";
  166. display: table;
  167. }
  168. .clearfix:after {
  169. clear: both;
  170. }
  171. .clearfix {
  172. zoom: 1;
  173. }
  174. /* 强制文本换行 */
  175. .textwrap, .textwrap td, .textwrap th {
  176. word-wrap: break-word;
  177. word-break: break-all;
  178. }
  179. .textwrap-table {
  180. table-layout: fixed;
  181. }
  182. /* 提供 serif 版本的字体设置: iOS 下中文自动 fallback 到 sans-serif */
  183. .serif {
  184. font-family: Palatino, Optima, Georgia, serif;
  185. }
  186. /* 保证块/段落之间的空白隔行 */
  187. .typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr, .typo table,
  188. .typo-p, .typo-pre, .typo-ul, .typo-ol, .typo-dl, .typo-form, .typo-hr, .typo-table, blockquote {
  189. margin-bottom: 1.2em
  190. }
  191. h1, h2, h3, h4, h5, h6 {
  192. font-family: PingFang SC, Verdana, Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif;
  193. font-weight: 100;
  194. color: #000;
  195. line-height: 1.35;
  196. }
  197. /* 标题应该更贴紧内容,并与其他块区分,margin 值要相应做优化 */
  198. .typo h1, .typo h2, .typo h3, .typo h4, .typo h5, .typo h6,
  199. .typo-h1, .typo-h2, .typo-h3, .typo-h4, .typo-h5, .typo-h6 {
  200. margin-top: 1.2em;
  201. margin-bottom: 0.6em;
  202. line-height: 1.35;
  203. }
  204. .typo h1, .typo-h1 {
  205. font-size: 2em;
  206. }
  207. .typo h2, .typo-h2 {
  208. font-size: 1.8em;
  209. }
  210. .typo h3, .typo-h3 {
  211. font-size: 1.6em;
  212. }
  213. .typo h4, .typo-h4 {
  214. font-size: 1.4em;
  215. }
  216. .typo h5, .typo h6, .typo-h5, .typo-h6 {
  217. font-size: 1.2em;
  218. }
  219. /* 在文章中,应该还原 ul 和 ol 的样式 */
  220. .typo ul, .typo-ul {
  221. margin-left: 1.3em;
  222. list-style: disc;
  223. }
  224. .typo ol, .typo-ol {
  225. list-style: decimal;
  226. margin-left: 1.9em;
  227. }
  228. .typo li ul, .typo li ol, .typo-ul ul, .typo-ul ol, .typo-ol ul, .typo-ol ol {
  229. margin-bottom: 0.8em;
  230. margin-left: 2em;
  231. }
  232. .typo li ul, .typo-ul ul, .typo-ol ul {
  233. list-style: circle;
  234. }
  235. /* 同 ul/ol,在文章中应用 table 基本格式 */
  236. .typo table th, .typo table td, .typo-table th, .typo-table td, .typo table caption {
  237. border: 1px solid #ddd;
  238. padding: 0.5em 1em;
  239. color: #666;
  240. }
  241. .typo table th, .typo-table th {
  242. background: #fbfbfb;
  243. }
  244. .typo table thead th, .typo-table thead th {
  245. background: #f1f1f1;
  246. }
  247. .typo table caption {
  248. border-bottom: none;
  249. }
  250. /* 去除 webkit 中 input 和 textarea 的默认样式 */
  251. .typo-input, .typo-textarea {
  252. -webkit-appearance: none;
  253. border-radius: 0;
  254. }
  255. .typo-em, .typo em, legend, caption {
  256. color: #000;
  257. font-weight: inherit;
  258. }
  259. /* 着重号,只能在少量(少于100个字符)且全是全角字符的情况下使用 */
  260. .typo-em {
  261. position: relative;
  262. }
  263. .typo-em:after {
  264. position: absolute;
  265. top: 0.65em;
  266. left: 0;
  267. width: 100%;
  268. overflow: hidden;
  269. white-space: nowrap;
  270. content: "・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・";
  271. }
  272. /* Responsive images */
  273. .typo img {
  274. max-width: 100%;
  275. }