Spring boot实训个人博客系统 (十一)博客详情页美化

1.下载内容排版插件:

网址:https://github.com/sofish/typo.css
在这里插入图片描述

2.导入插件typo.css文件:

在这里插入图片描述

3.在blog.html文件中引入typo.css:

<link rel="stylesheet" href="./static/css/typo.css">

在博文内容处,添加typo
在这里插入图片描述

在这里插入图片描述

4.修改typo.css文件:

把所有标签前都加入.typo

@charset "utf-8";

.typo p {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.8;
  text-align: justify;
}

.typo li {
  font-weight: 300;
  padding: 4px 0;
}

/* 重设 HTML5 标签, IE 需要在 js 中 createElement(TAG) */
.typo article, aside, details, figcaption, figure, footer, header, menu, nav, section {
  display: block;
}

/* HTML5 媒体文件跟 img 保持一致 */
.typo audio, canvas, video {
  display: inline-block;
}

/* 要注意表单元素并不继承父级 font 的问题 */
.typo button, input, select, textarea {
  font: 300 1em/1.8 PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif;
}

.typo button::-moz-focus-inner,
.typo input::-moz-focus-inner {
  padding: 0;
  border: 0;
}

/* 去掉各Table cell 的边距并让其边重合 */
.typo table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* 去除默认边框 */
.typo fieldset, img {
  border: 0;
}

/*/段落引用 */
.typo blockquote {
  position: relative;
  color: #999;
  font-weight: 400;
  border-left: 1px solid #1abc9c;
  padding-left: 1em;
  margin: 1em 3em 1em 2em;
}

@media only screen and ( max-width: 640px ) {
  .typo blockquote {
    margin: 1em 0;
  }
}

/* Firefox 以外,元素没有下划线,需添加 */
.typo acronym, abbr {
  border-bottom: 1px dotted;
  font-variant: normal;
}

/* 添加鼠标问号,进一步确保应用的语义是正确的(要知道,交互他们也有洁癖,如果你不去掉,那得多花点口舌) */
.typo abbr {
  cursor: help;
}

/* 一致的 del 样式 */
.typo del {
  text-decoration: line-through;
}

.typo address, caption, cite, code, dfn, em, th, var {
  font-style: normal;
  font-weight: 400;
}

/* 去掉列表前的标识, li 会继承,大部分网站通常用列表来很多内容,所以应该当去 */
.typo ul, ol {
  list-style: none;
}

/* 对齐是排版最重要的因素, 别让什么都居中 */
.typo caption, th {
  text-align: left;
}

.typo q:before,.typo  q:after {
  content: '';
}

/* 统一上标和下标 */
.typo sub,.typo  sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
}

.typo :root sub,.typo  :root sup {
  vertical-align: baseline; /* for ie9 and other modern browsers */
}

.typo sup {
  top: -0.5em;
}

.typo sub {
  bottom: -0.25em;
}

/* 让链接在 hover 状态下显示下划线 */
.typo a {
  color: #1abc9c;
}

.typo a:hover {
  text-decoration: underline;
}

.typo a {
  border-bottom: 1px solid #1abc9c;
}

.typo a:hover {
  border-bottom-color: #555;
  color: #555;
  text-decoration: none;
}

/* 默认不显示下划线,保持页面简洁 */
.typo ins,.typo  a {
  text-decoration: none;
}

/* 专名号:虽然 u 已经重回 html5 Draft,但在所有浏览器中都是可以使用的,
 * 要做到更好,向后兼容的话,添加 class="typo-u" 来显示专名号
 * 关于 <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
 * 一篇关于 <u> 标签的很好文章:http://html5doctor.com/u-element/
 */
.typo u,.typo  .typo-u {
  text-decoration: underline;
}

/* 标记,类似于手写的荧光笔的作用 */
.typo mark {
  background: #fffdd1;
  border-bottom: 1px solid #ffedce;
  padding: 2px;
  margin: 0 5px;
}

/* 代码片断 */
.typo pre,.typo  code,.typo  pre tt {
  font-family: Courier, 'Courier New', monospace;
}

.typo pre {
  background: #f8f8f8;
  border: 1px solid #ddd;
  padding: 1em 1.5em;
  display: block;
  -webkit-overflow-scrolling: touch;
}

/* 一致化 horizontal rule */
.typo hr {
  border: none;
  border-bottom: 1px solid #cfcfcf;
  margin-bottom: 0.8em;
  height: 10px;
}

/* 底部印刷体、版本等标记 */
.typo small,.typo  .typo-small,
  /* 图片说明 */
.typo figcaption {
  font-size: 0.9em;
  color: #888;
}

.typo strong,.typo  b {
  font-weight: bold;
  color: #000;
}

/* 可拖动文件添加拖动手势 */
.typo [draggable] {
  cursor: move;
}

.typo .clearfix:before,.typo  .clearfix:after {
  content: "";
  display: table;
}

.typo .clearfix:after {
  clear: both;
}

.typo .clearfix {
  zoom: 1;
}

/* 强制文本换行 */
.typo .textwrap,.typo .textwrap td,.typo  .textwrap th {
  word-wrap: break-word;
  word-break: break-all;
}

.typo .textwrap-table {
  table-layout: fixed;
}

/* 提供 serif 版本的字体设置: iOS 下中文自动 fallback 到 sans-serif */
.typo .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, blockquote {
  margin-bottom: 1.2em
}

.typo h1,.typo  h2,.typo  h3,.typo  h4,.typo  h5,.typo  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-top: 1.2em;
  margin-bottom: 0.6em;
  line-height: 1.35;
}

.typo h1, .typo-h1 {
  font-size: 2em;
}

.typo h2, .typo-h2 {
  font-size: 1.8em;
}

.typo h3, .typo-h3 {
  font-size: 1.6em;
}

.typo h4, .typo-h4 {
  font-size: 1.4em;
}

.typo h5, .typo h6, .typo-h5, .typo-h6 {
  font-size: 1.2em;
}

/* 在文章中,应该还原 ul 和 ol 的样式 */
.typo ul, .typo-ul {
  margin-left: 1.3em;
  list-style: disc;
}

.typo ol, .typo-ol {
  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-bottom: 0.8em;
  margin-left: 2em;
}

.typo li ul, .typo-ul ul, .typo-ol ul {
  list-style: circle;
}

/* 同 ul/ol,在文章中应用 table 基本格式 */
.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;
}

.typo table thead th, .typo-table thead th {
  background: #f1f1f1;
}

.typo table caption {
  border-bottom: none;
}

/* 去除 webkit 中 input 和 textarea 的默认样式  */
.typo-input, .typo-textarea {
  -webkit-appearance: none;
  border-radius: 0;
}

.typo-em, .typo em, legend, caption {
  color: #000;
  font-weight: inherit;
}

/* 着重号,只能在少量(少于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%;
}

5.设置文字样式:

设置字体大小、粗细、行间距、对齐方式(两端对齐)

.typo p {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.8;
  text-align: justify;
}

6.下载动画插件

网址:https://animate.style/
下载插件

在这里插入图片描述
把animate.css文件复制到CSS目录下
在这里插入图片描述

7.导入animate.css文件:

在这里插入图片描述

8.添加动画

fadeIn 效果:渐显
在这里插入图片描述

9.下载代码高亮插件

网址:https://github.com/PrismJS/prism
在这里插入图片描述
把下载的CSS、js文件复制到新建文件夹prism下
在这里插入图片描述

10.引入js、CSS文件

高亮代码显示效果得写进code标签中,才会显示出效果
CSS文件
在这里插入图片描述

11.添加代码高亮显示:

在这里插入图片描述
效果展示:

在这里插入图片描述
在这里插入图片描述
效果展示:
在这里插入图片描述

12.制作小工具条

13.目录留言

<button type="button" class="ui toc teal button" >目录</button>
        <a href="#comment-container" class="ui teal button" >留言</a>

14. 二维码

 <!--二维码-->
        <button class="ui wechat icon button"><i class="weixin icon"></i></button>

15.返回顶部

<div id="toTop-button" class="ui icon button" ><i class="chevron up icon"></i></div>

16.设置小工具条的位置

在这里插入图片描述

17.css文件中:

在这里插入图片描述

18.生成的目录

 <div class="ui toc-container flowing popup transition hidden" style="width: 250px!important;">
        <ol class="js-toc">
        </ol>
    </div>

19.下载目录生成插件:

网址:https://tscanlin.github.io/tocbot/
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
下载它
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

20.新建tocbot文件:

新建文件把刚下载的文件放入tocbot目录下

在这里插入图片描述

21.引入生成目录插件:

在这里插入图片描述

22.初始化

在官网上复制代码
在这里插入图片描述

23.下载滚动侦测插件:

网址:http://imakewebthings.com/waypoints/
直接下载

在这里插入图片描述

24.新建waypoints目录:

在这里插入图片描述

25.引入js文件:

在这里插入图片描述

26.插入js代码:

 var waypoint = new Waypoint({
            element: document.getElementById('waypoint'),
            handler: function(direction) {
                if (direction == 'down') {
                    $('#toolbar').show(100)
                }else {
                    $('#toolbar').hide(500);
                }
                console.log('Scrolled to waypoint!' + direction);
            }
        })

27.显示效果:

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值