article-detail.html 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. <!doctype html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" name="viewport">
  6. <meta content="ie=edge" http-equiv="X-UA-Compatible">
  7. <title>博客文章详情</title>
  8. <link href="icon.png" rel="icon">
  9. <link href="lib/fontawesome-free/css/all.css" rel="stylesheet">
  10. <link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet">
  11. <link href="lib/animate/animate.css" rel="stylesheet">
  12. <link href="lib/aos/aos.css" rel="stylesheet">
  13. <link href="lib/fancybox/jquery.fancybox.css" rel="stylesheet">
  14. <link href="lib/swiper/swiper-bundle.css" rel="stylesheet">
  15. <link href="styles/typo.css" rel="stylesheet">
  16. <link href="lib/prism/prism.css" rel="stylesheet">
  17. <link href="styles/main.css" rel="stylesheet">
  18. </head>
  19. <body class="blog-body">
  20. <!-- 导航栏 -->
  21. <nav class="navbar navbar-expand-md fixed-top bg-transparent has-img">
  22. <div class="container-fluid">
  23. <!-- 导航切换 -->
  24. <button aria-controls="offcanvasSideNavbar" class="nav-toggle d-md-none" data-bs-toggle="offcanvas" href="#offcanvasSideNavbar" role="button">
  25. <i class="fa-solid fa-sliders"></i>
  26. </button>
  27. <!-- 侧边导航 -->
  28. <div aria-labelledby="offcanvasSideNavbar" class="offcanvas offcanvas-start" id="offcanvasSideNavbar">
  29. <div class="offcanvas-header">
  30. <h5>风尘落微雨</h5>
  31. </div>
  32. <div class="offcanvas-body">
  33. <section class="d-md-none d-block sidebar-author position-relative">
  34. <div class="sidebar-banner border-0"></div>
  35. <div class="text-center">
  36. <img alt="" class="sidebar-avatar" src="images/acg.jpg">
  37. </div>
  38. <h2 class="fw-bold mt-5 fs-4 text-center">风尘落微雨</h2>
  39. <div class="sidebar-sign w-100">零星的变好,最后也会和星河一样闪耀</div>
  40. <div class="border-top">
  41. <table class="text-center my-2 w-100">
  42. <tbody>
  43. <tr class="fs-6 w-100">
  44. <th>文章</th>
  45. <th>评论</th>
  46. <th>标签</th>
  47. </tr>
  48. <tr>
  49. <td>45</td>
  50. <td>97</td>
  51. <td>44</td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. </section>
  57. <ul class="navbar-nav justify-content-start flex-grow-1 px-4 pt-4 px-md-0 pt-md-0 pe-md-3">
  58. <li class="nav-item"><a class="nav-link text-nowrap" href="index.html" target="_self">日常</a></li>
  59. <li class="nav-item"><a class="nav-link text-nowrap" href="say-something.html" target="_self">说说</a></li>
  60. <li class="nav-item"><a class="nav-link text-nowrap" href="pigeonhole.html" target="_self">归档</a></li>
  61. <li class="nav-item"><a class="nav-link text-nowrap" href="comments.html" target="_self">留言板</a></li>
  62. <li class="nav-item"><a class="nav-link text-nowrap" href="friendship-links.html" target="_self">友链</a></li>
  63. </ul>
  64. </div>
  65. </div>
  66. <!-- 搜索框 -->
  67. <button class="nav-search-button" data-bs-target="#searchModal" data-bs-toggle="modal">
  68. <i class="fa-solid fa-magnifying-glass"></i>
  69. </button>
  70. </div>
  71. </nav>
  72. <!-- 搜索框 -->
  73. <div class="search-modal modal" id="searchModal">
  74. <div class="modal-dialog">
  75. <div class="modal-content">
  76. <!-- 模态框头部 -->
  77. <div class="modal-header">
  78. <h4 class="modal-title">搜索文章</h4>
  79. <button class="btn-close" data-bs-dismiss="modal" type="button"></button>
  80. </div>
  81. <!-- 模态框内容 -->
  82. <div class="modal-body">
  83. <div class="search-form">
  84. <input class="form-control" placeholder="输入搜索关键词..." type="text">
  85. <button class="btn btn-primary mt-2">搜索</button>
  86. </div>
  87. </div>
  88. <!-- 模态框底部 -->
  89. <div class="modal-footer">
  90. <button class="btn btn-secondary" data-bs-dismiss="modal" type="button">关闭</button>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <!-- 英雄 -->
  96. <div class="hero-box" id="hero-box"></div>
  97. <!-- 模式切换 -->
  98. <div class="mode_switcher my_switcher">
  99. <button class="light align-items-center" id="themeToggle">
  100. <i class="fa-solid fa-moon dark__mode me-2"></i>
  101. <i class="fa-solid fa-sun light__mode d-none me-2"></i>
  102. <span class="dark__mode">Dark</span>
  103. <span class="light__mode d-none">Light</span>
  104. </button>
  105. </div>
  106. <!-- 主体 -->
  107. <main class="main-wrap container" id="main-wrap">
  108. <div class="row justify-content-center mt-4">
  109. <div class="col-lg-3">
  110. <div class="h-100 d-none d-lg-block">
  111. <section class="sidebar-author card">
  112. <div class="sidebar-banner"></div>
  113. <div class="text-center">
  114. <img alt="" class="sidebar-avatar" src="images/wallhaven-exkg7w.jpg">
  115. </div>
  116. <h2 class="fw-bold mt-5 fs-4 text-center">风尘落微雨</h2>
  117. <div class="sidebar-sign w-100">零星的变好,最后也会和星河一样闪耀</div>
  118. <div class="border-top">
  119. <table class="text-center my-2 w-100">
  120. <tbody>
  121. <tr class="fs-6 w-100">
  122. <th>文章</th>
  123. <th>评论</th>
  124. <th>标签</th>
  125. </tr>
  126. <tr>
  127. <td>45</td>
  128. <td>97</td>
  129. <td>44</td>
  130. </tr>
  131. </tbody>
  132. </table>
  133. </div>
  134. </section>
  135. <!-- 文章目录导航 -->
  136. <div class="toc-container card mt-4">
  137. <div class="toc-header">文章目录</div>
  138. <div class="toc-nav">
  139. <a class="active" href="#section1">一、关于 Typo.css</a>
  140. <a href="#section2">二、排版实例</a>
  141. <a href="#section2-1" style="padding-left: 2rem;">例1:论语学而篇第一</a>
  142. <a href="#section2-2" style="padding-left: 2rem;">例2:英文排版</a>
  143. <a href="#section3">三、附录</a>
  144. <a href="#appendix1" style="padding-left: 2rem;">1、Typo.css 排版偏重点</a>
  145. <a href="#appendix2" style="padding-left: 2rem;">2、开源许可</a>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="col-lg-9">
  151. <section class="card article-detail">
  152. <div class="d-flex text-xs mx-4 py-4 border-bottom" id="breadcrumbs">
  153. <div class="item d-flex align-items-center text-nowrap gap-1">
  154. <i class="fa-solid fa-house breadcrumbs-icon icon" style="color: #2563eb;"></i>
  155. <a href="index.html" title="首页">首页</a>
  156. </div>
  157. <span class="mx-2">/</span>
  158. <span class="item">
  159. <a href="#" title="✨日常">✨日常</a>
  160. </span>
  161. <span class="mx-2">/</span>
  162. <span class="item">正文</span>
  163. </div>
  164. <div class="my-4 px-3 px-md-4 h-100" id="post-box">
  165. <article class="typography typo js-toc-content" id="post-content">
  166. <h1>中文网页重设与排版:<i class="serif">Typo.css</i></h1>
  167. <!-- 添加文章元信息 -->
  168. <div class="article-meta d-flex flex-wrap gap-3">
  169. <div class="meta-item">
  170. <i class="fa-regular fa-calendar"></i>
  171. <span>2025-01-01</span>
  172. </div>
  173. <div class="meta-item">
  174. <i class="fa-regular fa-clock"></i>
  175. <span>阅读时长: 8分钟</span>
  176. </div>
  177. <div class="meta-item">
  178. <i class="fa-regular fa-eye"></i>
  179. <span>阅读量: 128</span>
  180. </div>
  181. </div>
  182. <h2 class="serif" id="tagline">一致化浏览器排版效果,构建最适合中文阅读的网页排版</h2>
  183. <ol id="table">
  184. <li><a href="#section1">关于 <i class="serif">Typo.css</i></a></li>
  185. <li><a href="#section2">排版实例</a>
  186. <ul>
  187. <li><a href="#section2-1">例1:论语学而篇第一</a></li>
  188. <li><a href="#section2-2">例2:英文排版</a></li>
  189. </ul>
  190. </li>
  191. <li><a href="#section3">附录</a>
  192. <ul>
  193. <li><a href="#appendix1"><i class="serif">Typo.css</i> 排版偏重点</a></li>
  194. <li><a href="#appendix2">开源许可</a></li>
  195. </ul>
  196. </li>
  197. </ol>
  198. <h2 id="section1">一、关于 <i class="serif">Typo.css</i></h2>
  199. <p><i class="serif">Typo.css</i> 的目的是,在一致化浏览器排版效果的同时,构建最适合中文阅读的网页排版。</p>
  200. <h4>现状和如何去做:</h4>
  201. <p class="typo-first">排版是一个麻烦的问题 <sup><a href="#appendix1"># 附录一</a></sup>,需要精心设计,而这个设计却是常被视觉设计师所忽略的。前端工程师更常看到这样的问题,但不便变更。因为在多个 OS 中的不同浏览器渲染不同,改动需要多的时间做回归测试,所以改变变得更困难。而像我们一般使用的
  202. Yahoo、Eric Meyer 和 Alice base.css 中采用的 Reset 都没有很好地考虑中文排版。<i class="serif">Typo.css</i> 要做的就是解决中文排版的问题。</p>
  203. <p><strong><i class="serif">Typo.css</i> 测试于如下平台:</strong></p>
  204. <div class="table-responsive">
  205. <table class="table" summary="Typo.css 的测试平台列表">
  206. <thead>
  207. <tr>
  208. <th>OS/浏览器</th>
  209. <th>Firefox</th>
  210. <th>Chrome</th>
  211. <th>Safari</th>
  212. <th>Opera</th>
  213. <th>IE9</th>
  214. <th>IE8</th>
  215. <th>IE7</th>
  216. <th>IE6</th>
  217. </tr>
  218. </thead>
  219. <tbody>
  220. <tr>
  221. <td>OS X</td>
  222. <td>✔</td>
  223. <td>✔</td>
  224. <td>✔</td>
  225. <td>✔</td>
  226. <td>-</td>
  227. <td>-</td>
  228. <td>-</td>
  229. <td>-</td>
  230. </tr>
  231. <tr>
  232. <td>Win 7</td>
  233. <td>✔</td>
  234. <td>✔</td>
  235. <td>✔</td>
  236. <td>✔</td>
  237. <td>✔</td>
  238. <td>✔</td>
  239. <td>✔</td>
  240. <td>-</td>
  241. </tr>
  242. <tr>
  243. <td>Win XP</td>
  244. <td>✔</td>
  245. <td>✔</td>
  246. <td>✔</td>
  247. <td>✔</td>
  248. <td>-</td>
  249. <td>✔</td>
  250. <td>✔</td>
  251. <td>✔</td>
  252. </tr>
  253. <tr>
  254. <td>Ubuntu</td>
  255. <td>✔</td>
  256. <td>✔</td>
  257. <td>-</td>
  258. <td>✔</td>
  259. <td>-</td>
  260. <td>-</td>
  261. <td>-</td>
  262. <td>-</td>
  263. </tr>
  264. </tbody>
  265. </table>
  266. </div>
  267. <h4>中文排版的重点和难点</h4>
  268. <p>在中文排版中,HTML4 的很多标准在语义在都有照顾到。但从视觉效果上,却很难利用单独的 CSS 来实现,像<abbr title="在文字下多加一个点">着重号</abbr>(例:这里<em class="typo-em">强调一下</em>)。在 HTML4 中,专名号标签(<code>&lt;u&gt;</code>)已经被放弃,而
  269. HTML5 被<a href="//html5doctor.com/u-element/">重新提起</a>。<i class="serif">Typo.css</i> 也根据实际情况提供相应的方案。我们重要要注意的两点是:</p>
  270. <ol>
  271. <li>语义:语义对应的用法和样式是否与中文排版一致</li>
  272. <li>表现:在各浏览器中的字体、大小和缩放是否如排版预期</li>
  273. </ol>
  274. <p>对于这些,<i class="serif">Typo.css</i> 排版项目的中文偏重注意点,都添加在附录中,详见:</p>
  275. <blockquote>
  276. <b>附录一</b>:<a href="#appendix1"><i class="serif">Typo.css</i> 排版偏重点</a>
  277. </blockquote>
  278. <p>目前已有像百姓网等全面使用 <i class="serif">Typo.css</i> 的项目,测试平台的覆盖,特别是在<abbr title="手机、平板电脑等移动平台">移动端</abbr>上还没有覆盖完主流平台,希望有能力的同学能加入测试行列,或者加入到 <i class="serif">Typo.css</i>
  279. 的开发。加入方法:<a href="https://github.com/sofish/Typo.css">参与 <i class="serif">Typo.css</i> 开发</a>。如有批评、建议和意见,也随时欢迎给在 Github 直接提 <a
  280. href="https://github.com/sofish/Typo.css/issues">issues</a>,或给<abbr role="author"
  281. title="Sofish Lin, author of Typo.css">我</abbr>发<a
  282. href="mailto:sofish@icloud.com">邮件</a>。</p>
  283. <h2 id="section2">二、排版实例:</h2>
  284. <p>提供2个排版实例,第一个中文实例来自于来自于<cite class="typo-unique">张燕婴</cite>的《论语》,由于古文排版涉及到的元素比较多,所以采用《论语》中《学而》的第一篇作为排版实例介绍;第2个来自到经典的
  285. Lorem Ipsum,并加入了一些代码和列表等比较具有代表性的排版元素。</p>
  286. <h3 id="section2-1">例1:论语学而篇第一</h3>
  287. <p>
  288. <small><b>作者:</b><abbr title="名丘,字仲尼">孔子</abbr>(
  289. <time>前551年9月28日-前479年4月11日</time>
  290. </small>
  291. </p>
  292. <h4>本篇引语</h4>
  293. <p>
  294. 《学而》是《论语》第一篇的篇名。《论语》中各篇一般都是以第一章的前二三个字作为该篇的篇名。《学而》一篇包括16章,内容涉及诸多方面。其中重点是「吾日三省吾身」;「节用而爱人,使民以时」;「礼之用,和为贵」以及仁、孝、信等道德范畴。 </p>
  295. <h4>原文</h4>
  296. <p>子曰:「学而时习之,不亦说乎?有朋自远方来,不亦乐乎?人不知,而不愠,不亦君子乎?」 </p>
  297. <h4>译文</h4>
  298. <p>孔子说:「学了又时常温习和练习,不是很愉快吗?有志同道合的人从远方来,不是很令人高兴的吗?人家不了解我,我也不怨恨、恼怒,不也是一个有德的君子吗?」 </p>
  299. <h4>评析</h4>
  300. <p>宋代著名学者<u class="typo-u">朱熹</u>对此章评价极高,说它是「入道之门,积德之基」。本章这三句话是人们非常熟悉的。历来的解释都是:学了以后,又时常温习和练习,不也高兴吗等等。三句话,一句一个意思,前后句子也没有什么连贯性。但也有人认为这样解释不符合原义,指出这里的「学」不是指学习,而是指学说或主张;「时」不能解为时常,而是时代或社会的意思,「习」不是温习,而是使用,引申为采用。而且,这三句话不是孤立的,而是前后相互连贯的。这三句的意思是:自己的学说,要是被社会采用了,那就太高兴了;退一步说,要是没有被社会所采用,可是很多朋友赞同<abbr
  301. title="张燕婴">我</abbr>的学说,纷纷到我这里来讨论问题,我也感到快乐;再退一步说,即使社会不采用,人们也不理解我,我也不怨恨,这样做,不也就是君子吗?(见《齐鲁学刊》1986年第6期文)这种解释可以自圆其说,而且也有一定的道理,供读者在理解本章内容时参考。
  302. </p>
  303. <p>此外,在对「人不知,而不愠」一句的解释中,也有人认为,「人不知」的后面没有宾语,人家不知道什么呢?当时因为孔子有说话的特定环境,他不需要说出知道什么,别人就可以理解了,却给后人留下一个谜。有人说,这一句是接上一句说的,从远方来的朋友向我求教,我告诉他,他还不懂,我却不怨恨。这样,「人不知」就是「人家不知道我所讲述的」了。这样的解释似乎有些牵强。</p>
  304. <p>总之,本章提出以学习为乐事,做到人不知而不愠,反映出孔子学而不厌、诲人不倦、注重修养、严格要求自己的主张。这些思想主张在《论语》书中多处可见,有助于对第一章内容的深入了解。</p>
  305. <h3 id="section2-2">例2:英文排版</h3>
  306. <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
  307. standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a
  308. type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining
  309. essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
  310. passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem
  311. Ipsum.</p>
  312. <blockquote>
  313. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
  314. aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  315. </blockquote>
  316. <h4>The standard Lorem Ipsum passage, used since the 1500s</h4>
  317. <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
  318. aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  319. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
  320. occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
  321. <h4>Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</h4>
  322. <p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam,
  323. eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam
  324. voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
  325. voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci
  326. velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim
  327. ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi
  328. consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur,
  329. vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
  330. <h4>List style in action</h4>
  331. <ul>
  332. <li>If you wish to succeed, you should use persistence as your good friend, experience as your reference, prudence as
  333. your brother and hope as your sentry.
  334. <p>如果你希望成功,当以恒心为良友,以经验为参谋,以谨慎为兄弟,以希望为哨兵。</p>
  335. </li>
  336. <li>Sometimes one pays most for the things one gets for nothing.
  337. <p>有时候一个人为不花钱得到的东西付出的代价最高。</p>
  338. </li>
  339. <li>Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things
  340. easily.
  341. <p>只有有耐心圆满完成简单工作的人,才能够轻而易举的完成困难的事。</p>
  342. </li>
  343. </ul>
  344. <h4>You may want to create a perfect <code>&lt;hr /&gt;</code> line, despite the fact that there will never have one
  345. </h4>
  346. <hr/>
  347. <p><abbr title="法国作家罗切福考尔德">La Racheforcauld</abbr> said:
  348. <mark>"Few things are impossible in themselves; and it is often for want of will, rather than of means, that man fails
  349. to succeed".
  350. </mark>
  351. You just need to follow the browser's behavior, and set a right <code>margin</code> to it。it will works nice as the
  352. demo you're watching now. The following code is the best way to render typo in Chinese:
  353. </p>
  354. <pre>
  355. <code class="language-css">
  356. /* 标题应该更贴紧内容,并与其他块区分,margin 值要相应做优化 */
  357. h1,h2,h3,h4,h5,h6 {
  358. line-height:1;font-family:Arial,sans-serif;margin:1.4em 0 0.8em;
  359. }
  360. h1{font-size:1.8em;}
  361. h2{font-size:1.6em;}
  362. h3{font-size:1.4em;}
  363. h4{font-size:1.2em;}
  364. h5,h6{font-size:1em;}
  365. /* 现代排版:保证块/段落之间的空白隔行 */
  366. .typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr {
  367. margin:1em 0 0.6em;
  368. }
  369. </code>
  370. </pre>
  371. <h3 id="section3">三、附录</h3>
  372. <h5 id="appendix1">1、<i class="serif">Typo.css</i> 排版偏重点</h5>
  373. <div class="table-responsive">
  374. <table class="table" summary="Typo.css 排版偏重点">
  375. <thead>
  376. <tr>
  377. <th>类型</th>
  378. <th>语义</th>
  379. <th>标签</th>
  380. <th>注意点</th>
  381. </tr>
  382. </thead>
  383. <tbody>
  384. <tr>
  385. <th rowspan="15">基础标签</th>
  386. <td>标题</td>
  387. <td><code>h1</code> ~ <code>h6</code></td>
  388. <td>全局不强制大小,<code>.typo</code> 中标题与其对应的内容应紧贴,并且有相应的大小设置</td>
  389. </tr>
  390. <tr>
  391. <td>上、下标</td>
  392. <td><code>sup</code>/<code>sub</code></td>
  393. <td>保持与 MicroSoft Office Word 等程序的日常排版一致</td>
  394. </tr>
  395. <tr>
  396. <td>引用</td>
  397. <td><code>blockquote</code></td>
  398. <td>显示/嵌套样式</td>
  399. </tr>
  400. <tr>
  401. <td>缩写</td>
  402. <td><code>abbr</code></td>
  403. <td>是否都有下划线,鼠标 <code>hover</code> 是否为帮助手势</td>
  404. </tr>
  405. <tr>
  406. <td>分割线</td>
  407. <td><code>hr</code></td>
  408. <td>显示的 <code>padding</code> 和 <code>margin</code>正确</td>
  409. </tr>
  410. <tr>
  411. <td>列表</td>
  412. <td><code>ul</code>/<code>ol</code>/<code>dl</code></td>
  413. <td>在全局没有 <code>list-style</code>,在 .<code>typo</code> 中对齐正确</td>
  414. </tr>
  415. <tr>
  416. <td>定义列表</td>
  417. <td><code>dl</code></td>
  418. <td>全局 <code>padding</code> 和 <code>margin</code>为0, .<code>typo</code> 中对齐正确</td>
  419. </tr>
  420. <tr>
  421. <td>选项</td>
  422. <td><code>input[type=radio[, checkbox]]</code></td>
  423. <td>与其他 <code>form</code> 元素排版时是否居中</td>
  424. </tr>
  425. <tr>
  426. <td>斜体</td>
  427. <td><code>i</code></td>
  428. <td>只设置一种斜体,让 <code>em</code> 和 <code>cite</code> 显示为正体</td>
  429. </tr>
  430. <tr>
  431. <td>强调</td>
  432. <td><code>em</code></td>
  433. <td>在全局显示正体,在 <code>.typo</code> 中显示与 <code>b</code> 和 <code>strong</code> 的样式一致,为粗体</td>
  434. </tr>
  435. <tr>
  436. <td>加强</td>
  437. <td><code>strong/b</code></td>
  438. <td>显示为粗体</td>
  439. </tr>
  440. <tr>
  441. <td>标记</td>
  442. <td><code>mark</code></td>
  443. <td>类似荧光笔</td>
  444. </tr>
  445. <tr>
  446. <td>印刷</td>
  447. <td><code>small</code></td>
  448. <td>保持为正确字体的 80% 大小,颜色设置为浅灰色</td>
  449. </tr>
  450. <tr>
  451. <td>表格</td>
  452. <td><code>table</code></td>
  453. <td>全局不显示线条,在 <code>table</code> 中显示表格外框,并且表头有浅灰背景</td>
  454. </tr>
  455. <tr>
  456. <td>代码</td>
  457. <td><code>pre</code>/<code>code</code></td>
  458. <td>字体使用 <code>courier</code> 系字体,保持与 <code>serif</code> 有比较一致的显示效果</td>
  459. </tr>
  460. <tr>
  461. <th rowspan="5">特殊符号</th>
  462. <td>着重号</td>
  463. <td><em class="typo-em">在文字下加点</em></td>
  464. <td>在支持 <code>:after</code> 和 <code>:before</code> 的浏览器可以做渐进增强实现</td>
  465. </tr>
  466. <tr>
  467. <td>专名号</td>
  468. <td><u>林建锋</u></td>
  469. <td>专名号,有下划线,使用 <code>u</code> 或都 <code>.typo-u</code> 类</td>
  470. </tr>
  471. <tr>
  472. <td>破折号</td>
  473. <td>——</td>
  474. <td>保持一划,而非两划</td>
  475. </tr>
  476. <tr>
  477. <td>人民币</td>
  478. <td>&yen;</td>
  479. <td>使用两平等线的符号,或者 HTML 实体符号 <code>&amp;yen;</code></td>
  480. </tr>
  481. <tr>
  482. <td>删除符</td>
  483. <td>
  484. <del>已删除(deleted)</del>
  485. </td>
  486. <td>一致化各浏览器显示,中英混排正确</td>
  487. </tr>
  488. <tr>
  489. <th rowspan="3">加强类</th>
  490. <td>专名号</td>
  491. <td><code>.typo-u</code></td>
  492. <td>由于 <code>u</code> 被 HTML4 放弃,在向后兼容上推荐使用 <code>.typo-u</code></td>
  493. </tr>
  494. <tr>
  495. <td>着重符</td>
  496. <td><code>.typo-em</code></td>
  497. <td>利用 <code>:after</code> 和 <code>:before</code> 实现着重符</td>
  498. </tr>
  499. <tr>
  500. <td>清除浮动</td>
  501. <td><code>.clearfix</code></td>
  502. <td>与一般 CSS Reset 保持一对致 API</td>
  503. </tr>
  504. <tr>
  505. <th rowspan="5">注意点</th>
  506. <td colspan="3">(1)中英文混排行高/行距</td>
  507. </tr>
  508. <tr>
  509. <td colspan="3">(2)上下标在 IE 中显示效果</td>
  510. </tr>
  511. <tr>
  512. <td colspan="3">(3)块/段落分割空白是否符合设计原则</td>
  513. </tr>
  514. <tr>
  515. <td colspan="3">(4)input 多余空间问题</td>
  516. </tr>
  517. <tr>
  518. <td colspan="3">(5)默认字体色彩,目前采用 <code>#333</code> 在各种浏览显示比较好</td>
  519. </tr>
  520. </tbody>
  521. </table>
  522. </div>
  523. <h5 id="appendix2">2、开源许可</h5>
  524. <p><i class="serif">Typo.css</i> 基于 <a href="//zh.wikipedia.org/wiki/MIT_License">MIT License</a> 开源,使用代码只需说明来源,或者引用 <a
  525. href="//typo.sofi.sh/license.txt">license.txt</a> 即可。</p>
  526. </article>
  527. <div class="d-flex pt-4 mt-5 align-items-center border-top tag gap-1">
  528. <i class="fa-solid fa-hashtag icon" style="color: #2563eb;"></i>
  529. <div class="d-flex flex-wrap align-items-center text-xs gap-2">
  530. <a class="badge rounded-pill text-bg-primary tag-item" href="https://www.weirain.com/index.php/tag/Deepseek/">DeepSeek</a>
  531. <a class="badge rounded-pill text-bg-info tag-item" href="https://www.weirain.com/index.php/tag/AI/">AI</a>
  532. </div>
  533. </div>
  534. <div class="copyright text-xs text-wrap">
  535. <div class="d-flex align-items-center gap-1">
  536. <i class="fa-solid fa-user icon"></i>
  537. <div class="copyright-text">版权属于:风尘落微雨</div>
  538. </div>
  539. <div class="d-flex align-items-center gap-1">
  540. <i class="fa-solid fa-location-arrow icon"></i>
  541. <div class="copyright-text text-wrap">本文链接:https://www.weirain.com/index.php/archives/322/</div>
  542. </div>
  543. <div class="d-flex align-items-center gap-1">
  544. <i class="fa-solid fa-gem icon"></i>
  545. <div class="copyright-text">作品采用 <a class="text-decoration-none" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-Hans" target="_blank">
  546. 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 </a>进行许可
  547. </div>
  548. </div>
  549. </div>
  550. <!-- 文章导航 -->
  551. <div class="article-navigation d-flex justify-content-between mt-4 pt-4 border-top">
  552. <div class="prev-article">
  553. <a class="text-decoration-none" href="#">
  554. <div class="d-flex align-items-center gap-2">
  555. <i class="fa-solid fa-arrow-left"></i>
  556. <span class="text-xs">上一篇</span>
  557. </div>
  558. <div class="text-truncate mt-1">这是上一篇文章的标题</div>
  559. </a>
  560. </div>
  561. <div class="next-article text-end">
  562. <a class="text-decoration-none" href="#">
  563. <div class="d-flex align-items-center gap-2 justify-content-end">
  564. <span class="text-xs">下一篇</span>
  565. <i class="fa-solid fa-arrow-right"></i>
  566. </div>
  567. <div class="text-truncate mt-1">这是下一篇文章的标题</div>
  568. </a>
  569. </div>
  570. </div>
  571. <!-- 评论区域 -->
  572. <div class="comments-section mt-5 pt-4 border-top">
  573. <h3 class="mb-4">评论</h3>
  574. <!-- 评论表单 -->
  575. <div class="comment-form mb-5">
  576. <form>
  577. <div class="mb-3">
  578. <label class="form-label" for="commentName">昵称</label>
  579. <input class="form-control" id="commentName" placeholder="请输入您的昵称" type="text">
  580. </div>
  581. <div class="mb-3">
  582. <label class="form-label" for="commentEmail">邮箱</label>
  583. <input class="form-control" id="commentEmail" placeholder="请输入您的邮箱" type="email">
  584. </div>
  585. <div class="mb-3">
  586. <label class="form-label" for="commentContent">评论内容</label>
  587. <textarea class="form-control" id="commentContent" placeholder="请输入您的评论" rows="4"></textarea>
  588. </div>
  589. <button class="btn btn-primary" type="submit">提交评论</button>
  590. </form>
  591. </div>
  592. <!-- 评论列表 -->
  593. <div class="comments-list">
  594. <div class="comment-item mb-4">
  595. <div class="d-flex">
  596. <div class="flex-shrink-0">
  597. <img alt="用户头像" class="rounded-circle" height="40" src="images/acg.jpg" width="40">
  598. </div>
  599. <div class="flex-grow-1 ms-3">
  600. <div class="d-flex justify-content-between">
  601. <h6 class="mb-1">访客A</h6>
  602. <small class="text-muted">2025-01-01 10:30</small>
  603. </div>
  604. <p class="mb-1">这篇文章写得真好,学到了很多关于排版的知识!</p>
  605. <div class="d-flex gap-3 mt-2">
  606. <a class="text-decoration-none small" href="#">回复</a>
  607. <a class="text-decoration-none small" href="#">点赞(5)</a>
  608. </div>
  609. </div>
  610. </div>
  611. <!-- 回复评论 -->
  612. <div class="comment-item mt-3 ms-5">
  613. <div class="d-flex">
  614. <div class="flex-shrink-0">
  615. <img alt="用户头像" class="rounded-circle" height="40" src="images/wallhaven-exkg7w.jpg" width="40">
  616. </div>
  617. <div class="flex-grow-1 ms-3">
  618. <div class="d-flex justify-content-between">
  619. <h6 class="mb-1">风尘落微雨</h6>
  620. <small class="text-muted">2025-01-01 11:15</small>
  621. </div>
  622. <p class="mb-1">感谢您的支持!欢迎继续关注更多内容。</p>
  623. <div class="d-flex gap-3 mt-2">
  624. <a class="text-decoration-none small" href="#">回复</a>
  625. <a class="text-decoration-none small" href="#">点赞(2)</a>
  626. </div>
  627. </div>
  628. </div>
  629. </div>
  630. </div>
  631. <div class="comment-item mb-4">
  632. <div class="d-flex">
  633. <div class="flex-shrink-0">
  634. <img alt="用户头像" class="rounded-circle" height="40" src="images/acg.jpg" width="40">
  635. </div>
  636. <div class="flex-grow-1 ms-3">
  637. <div class="d-flex justify-content-between">
  638. <h6 class="mb-1">访客B</h6>
  639. <small class="text-muted">2025-01-01 14:20</small>
  640. </div>
  641. <p class="mb-1">Typo.css确实是个好工具,解决了中文排版的很多问题。</p>
  642. <div class="d-flex gap-3 mt-2">
  643. <a class="text-decoration-none small" href="#">回复</a>
  644. <a class="text-decoration-none small" href="#">点赞(3)</a>
  645. </div>
  646. </div>
  647. </div>
  648. </div>
  649. </div>
  650. </div>
  651. </div>
  652. </section>
  653. </div>
  654. </div>
  655. </main>
  656. <!-- 工具 -->
  657. <div class="tools gap-2">
  658. <div class="backup-btn" id="backupTop">
  659. <i class="fa-solid fa-arrow-up"></i>
  660. </div>
  661. </div>
  662. <!-- 脚 -->
  663. <footer class="footer p-4 text-center mt-4">
  664. <p class="small d-flex justify-content-center align-items-center gap-2">
  665. <span class="d-flex align-items-center">
  666. <i class="fa-solid fa-at"></i>
  667. 2025
  668. </span>
  669. <a href="index.html">DeepSeek-R1满血版</a>
  670. </p>
  671. </footer>
  672. <script src="lib/bootstrap/js/bootstrap.bundle.js"></script>
  673. <script src="lib/jquery/jquery.js"></script>
  674. <script src="lib/aos/aos.js"></script>
  675. <script src="lib/fancybox/jquery.fancybox.js"></script>
  676. <script src="lib/swiper/swiper-bundle.js"></script>
  677. <script src="lib/prism/prism.js"></script>
  678. <script src="lib/pjax/pjax.js"></script>
  679. <script src="script/main.js"></script>
  680. <script>
  681. $(function () {
  682. // 返回顶部按钮功能
  683. $('#backupTop').on('click', function () {
  684. $('html, body').animate({scrollTop: 0}, 500);
  685. });
  686. // 滚动时显示/隐藏返回顶部按钮
  687. $(window).on('scroll', function () {
  688. if ($(this).scrollTop() > 300) {
  689. $('#backupTop').fadeIn();
  690. } else {
  691. $('#backupTop').fadeOut();
  692. }
  693. });
  694. // 目录导航高亮
  695. $(window).on('scroll', function () {
  696. const scrollTop = $(window).scrollTop();
  697. let currentId = '';
  698. $('.js-toc-content').find('h1, h2, h3').each(function () {
  699. const headingTop = $(this).offset().top;
  700. if (scrollTop >= headingTop - 100) {
  701. currentId = $(this).attr('id');
  702. }
  703. });
  704. // 更新目录链接的激活状态
  705. $('.toc-nav a').removeClass('active');
  706. if (currentId) {
  707. $('.toc-nav a[href="#' + currentId + '"]').addClass('active');
  708. }
  709. });
  710. // 点击目录链接平滑滚动
  711. $('.toc-nav a').on('click', function (e) {
  712. e.preventDefault();
  713. const target = $($(this).attr('href'));
  714. if (target.length) {
  715. $('html, body').animate({
  716. scrollTop: target.offset().top - 80
  717. }, 500);
  718. }
  719. });
  720. });
  721. </script>
  722. <script>
  723. // 评论相关功能
  724. $(function () {
  725. // 提交评论表单
  726. $('.comment-form form').on('submit', function (e) {
  727. e.preventDefault();
  728. const name = $('#commentName').val();
  729. const email = $('#commentEmail').val();
  730. const content = $('#commentContent').val();
  731. if (!name || !email || !content) {
  732. alert('请填写完整信息');
  733. return;
  734. }
  735. // 这里应该发送AJAX请求保存评论
  736. // 模拟添加评论到页面
  737. const newComment = `
  738. <div class="comment-item mb-4">
  739. <div class="d-flex">
  740. <div class="flex-shrink-0">
  741. <img src="images/acg.jpg" alt="用户头像" class="rounded-circle" width="40" height="40">
  742. </div>
  743. <div class="flex-grow-1 ms-3">
  744. <div class="d-flex justify-content-between">
  745. <h6 class="mb-1">${name}</h6>
  746. <small class="text-muted">刚刚</small>
  747. </div>
  748. <p class="mb-1">${content}</p>
  749. <div class="d-flex gap-3 mt-2">
  750. <a href="#" class="text-decoration-none small">回复</a>
  751. <a href="#" class="text-decoration-none small">点赞(0)</a>
  752. </div>
  753. </div>
  754. </div>
  755. </div>
  756. `;
  757. $('.comments-list').prepend(newComment);
  758. // 清空表单
  759. $('#commentName').val('');
  760. $('#commentEmail').val('');
  761. $('#commentContent').val('');
  762. alert('评论提交成功!');
  763. });
  764. // 点赞功能
  765. $(document).on('click', '.comment-item a:contains("点赞")', function (e) {
  766. e.preventDefault();
  767. const likeLink = $(this);
  768. const likeText = likeLink.text();
  769. const likeCount = parseInt(likeText.match(/\d+/)[0]);
  770. likeLink.text(`点赞(${likeCount + 1})`);
  771. });
  772. // 回复功能
  773. $(document).on('click', '.comment-item a:contains("回复")', function (e) {
  774. e.preventDefault();
  775. const commentItem = $(this).closest('.comment-item');
  776. const commenterName = commentItem.find('h6').first().text();
  777. $('#commentContent').val(`@${commenterName} `).focus();
  778. });
  779. });
  780. </script>
  781. </body>
  782. </html>