目录
用户登录页场景

博客列表页场景

博客详情页场景

博客编辑页场景

每个场景都是由镀多个功能区组成的
- html>
- <html lang="zh-hans">
- <head>
- <meta charset="UTF-8">
- <title>博客列表title>
- <link rel="stylesheet" href="./css/List.css">
- head>
- <body>
- <div class="导航栏">
- <div class="导航栏左边">
- <div class="logo-shell">
- <img class="logo" src="./img/logo.jpg">
- div>
- 我的博客系统
- div>
- <div class="导航栏右边">
- <a href="/List.html">主页a>
- <a href="/edit.html">写博客a>
- <a href="/login.html">注销a>
- div>
- div>
- <div class="下面区域">
- <div class="用户信息展示">
- <div class="头像展示区">
- <img src="./img/avatar.jpg">
- div>
- <div class="用户名称">小熊吃糖div>
- <div class="git地址">
- <a href="https://gitee.com/ren-xiaoxiong">gitee 地址a>
- div>
- <div class="统计信息">
- <div class="文章数量区域">
- <div>文章div>
- <div class="文章数量">2div>
- div>
- <div class="分类数量区域">
- <div>分类div>
- <div class="分类数量">2div>
- div>
- div>
- div>
- <div class="博客列表展示">
- <div class="博客项">
- <h3 class="博客标题">我的第一篇博客h3>
- <p class="发表日期">2022-08-09 09:31:28p>
- <p class="简介信息">从今天起, 我要认真敲代码. Lorem ipsum, dolor sit amet consectetur adipisicing elit.
- Cum distinctio ullam eum ut veroab laborum numquam tenetur est in dolorum a sint, assumenda adipisci
- similique quaerat vel. Facere,et.p>
- <div class="按钮区域"><a href="/edit.html">查看全文 >>a>div>
- div>
- <div class="博客项">
- <h3 class="博客标题">我的第二篇博客h3>
- <p class="发表日期">2022-08-11 16:31:35p>
- <p class="简介信息">从今天起, 我要认真敲代码. Lorem ipsum, dolor sit amet consectetur adipisicing elit.
- Cum distinctio ullam eum ut veroab laborum numquam tenetur est in dolorum a sint, assumenda adipisci
- similique quaerat vel. Facere,et.p>
- <div class="按钮区域"><a href="/edit.html">查看全文 >>a>div>
- div>
- div>
- div>
- body>
- html>
- @import "NavigationBar.css";
-
- .下面区域 {
- min-height: calc(100vh - 50px);
- /* background-color: #215877; */
-
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- padding: 8px 220px;
- }
-
- .用户信息展示 {
- width: 220px;
- background-color: rgba(255, 255, 255, .6);
- border-radius: 8px;
- padding: 12px 0;
- box-shadow: 0 0 5px #000;
- }
-
- .用户信息展示 {
- display: flex;
- flex-direction: column;
- gap: 12px;
- align-items: center;
- justify-content: space-between;
- }
-
- .头像展示区 {
- width: 100px;
- height: 100px;
- border-radius: 50%;
- overflow: hidden;
- }
-
- .头像展示区 img {
- width: 100px;
- }
-
- .用户名称 {
- font-size: 24px;
- font-weight: 700;
- }
-
- .git地址 a {
- color: #ea7a7a;
- font-size: 14px;
- font-style: italic;
- }
-
- .统计信息 {
- display: flex;
- align-items: stretch;
- justify-content: space-between;
- gap: 18px; /*间隔*/
- }
-
- .文章数量区域,
- .分类数量区域 {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- gap: 8px;
- }
-
- .博客列表展示 {
- min-height: calc(100vh - 50px - 8px - 8px);
- width: calc(100% - 220px - 8px);
- background-color: rgba(255, 255, 255, .6);
- border-radius: 8px;
- box-shadow: 0 0 5px #000;
-
- padding: 8px;
- }
- .博客项{
- width: 100%;
- margin: 12px;
- display: flex;
- flex-direction: column;
- align-items: stretch;
- justify-content: space-between;
- gap: 8px;
- }
-
- .博客标题{
- text-align: center;
- font-size: 24px;
- font-weight: 900;
- }
-
- .发表日期{
- text-align: center;
- color: #3ff159;
- }
-
- .简介信息{
- text-indent: 2em;
- font-size: 16px;
- }
-
- .按钮区域{
- display: flex;
- justify-content: center;
- }
-
- .博客项 a{
- width: 180px;
- height: 40px;
- line-height: 40px;
- text-align: center;
- font-size: 16px;
- color: black;
- text-decoration: none;
- border: 2px solid #000;
- }
导航栏的CSS
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- font-family: '宋体', fangsong;
- font-size: 18px;
- }
-
- body {
- width: 100%;
- min-height: 100vh;
- /* background-color: #f519e3; */
-
- background-image: url(../img/background.jpg);
- background-size: cover;
- background-position: 0 -80px; /* 大家如果自己找的背景图,可能要修改这里 */
- background-repeat: no-repeat;
- background-attachment: fixed;
- }
-
- .导航栏 {
- width: 100%;
- height: 50px;
- /* background-color: #95c766; */
- background-color: rgba(154, 223, 223, .5);
-
- display: flex;
- align-items: stretch;
- justify-content: space-between;
-
- padding: 0 12px;
- }
-
- .导航栏左边, .导航栏右边 {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .导航栏左边 > *,
- .导航栏右边 > * {
- margin: 0 16px;
- }
-
- .logo-shell {
- width: 36px;
- height: 36px;
- border-radius: 50%;
- overflow: hidden;
- }
-
- .logo {
- width: 36px;
- height: 36px;
- }
-
- .导航栏 {
- color: #fff;
- }
-
- .导航栏 a {
- color: #fff;
- text-decoration: none;
- }
-

- html>
- <html lang="zh-hans">
- <head>
- <meta charset="UTF-8">
- <title>博客列表title>
- <link rel="stylesheet" href="./css/login.css">
- head>
- <body>
- <div class="导航栏">
- <div class="导航栏左边">
- <div class="logo-shell">
- <img class="logo" src="./img/logo.jpg">
- div>
- 我的博客系统
- div>
- <div class="导航栏右边">
- <a href="/List.html">主页a>
- <a href="/edit.html">写博客a>
- <a href="/login.html">注销a>
- div>
- div>
- <div class="下面区域">
-
-
- <form method="post" action="/login.do">
- <h1>登录h1>
- <label>
- 用户名
- <input type="text" name="username">
- label>
- <label>
- 密码
- <input type="password" name="password">
- label>
- <button>提交button>
- form>
- div>
- body>
- html>
- @import "NavigationBar.css";
-
- .下面区域{
- min-height: calc(100vh - 50px);
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .下面区域 form{
- background-color: rgba(255,255,255,.6);
- padding: 16px;
- border-radius: 8px;
- box-shadow: 0 0 5px #000;
-
- width: 600px ;
- display: flex;
- flex-direction: column;
- align-items: stretch;
- justify-content: space-between;
- }
-
- .下面区域 form > *{
- margin: 12px;
- }
-
- .下面区域 h1{
- text-align: center;
- }
-
- .下面区域 label{
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .下面区域 input{
- width: 400px;
- border: none;
- outline: none;
- border-radius: 4px;
- }
-
- .下面区域 input,
- .下面区域 button{
- height: 30px;
- line-height: 30px;
- }
-
- .下面区域 button{
- background-color: #91e59e;
- border: none;
- color: #ffffff;
- }

和博客列表页类似,只需要更换内容即可
- html>
- <html lang="zh-hans">
- <head>
- <meta charset="UTF-8">
- <title>博客列表页title>
- <link rel="stylesheet" href="./css/details.css">
- head>
- <body>
- <div class="导航栏">
- <div class="导航栏左边">
- <div class="logo-shell">
- <img class="logo" src="./img/logo.jpg">
- div>
- 我的博客系统
- div>
- <div class="导航栏右边">
- <a href="/List.html">主页a>
- <a href="/edit.html">写博客a>
- <a href="/login.html">注销a>
- div>
- div>
- <div class="下面区域">
- <div class="用户信息展示">
- <div class="头像展示区">
- <img src="./img/avatar.jpg">
- div>
- <div class="用户名称">小熊吃糖div>
- <div class="git地址">
- <a href="https://gitee.com/ren-xiaoxiong">gitee 地址a>
- div>
- <div class="统计信息">
- <div class="文章数量区域">
- <div>文章div>
- <div class="文章数量">2div>
- div>
- <div class="分类数量区域">
- <div>分类div>
- <div class="分类数量">2div>
- div>
- div>
- div>
- <div class="博客列表展示">
- <div class="博客项">
- <h3 class="博客标题">我的第一篇博客h3>
- <p class="发表日期">2022-08-09 09:31:28p>
- <p class="简介信息">从今天起, 我要认真敲代码. Lorem ipsum, dolor sit amet consectetur adipisicing elit.
- Cum distinctio ullam eum ut veroab laborum numquam tenetur est in dolorum a sint, assumenda adipisci
- similique quaerat vel. Facere,et.p>
- <div class="按钮区域"><a href="/details.html">查看全文 >>a>div>
- div>
- <div class="博客项">
- <h3 class="博客标题">我的第二篇博客h3>
- <p class="发表日期">2022-08-11 16:31:35p>
- <p class="简介信息">从今天起, 我要认真敲代码. Lorem ipsum, dolor sit amet consectetur adipisicing elit.
- Cum distinctio ullam eum ut veroab laborum numquam tenetur est in dolorum a sint, assumenda adipisci
- similique quaerat vel. Facere,et.p>
- <div class="按钮区域"><a href="/details.html">查看全文 >>a>div>
- div>
- div>
- div>
- body>
- html>
@import "List.css";

我们导入别人已经写好的开源编辑器,引入 editor.md
官网参见: https://pandao.github.io/editor.md/
首先引入需要的文件
- <script src="./js/jquery.min.js">script>
- <script src="./editor.md/lib/marked.min.js">script>
- <script src="./editor.md/lib/prettify.min.js">script>
- <script src="./editor.md/editormd.js">script>
需要初始化编辑器
- // 初始化编辑器
- let editor = editormd("编辑器", {
- // 这里的尺寸必须在这里设置. 设置样式会被 editormd 自动覆盖掉.
- width: "100%",
- // 高度 100% 意思是和父元素一样高. 要在父元素的基础上去掉标题编辑区的高度
- height: "calc(100% - 50px)",
- // 编辑器中的初始内容
- markdown: "# 在这里写下一篇博客",
- // 指定 editor.md 依赖的插件路径
- path: "./editor.md/lib/"
- });
- html>
- <html lang="zh-hans">
- <head>
- <meta charset="UTF-8">
- <title>博客编辑页title>
- <link rel="stylesheet" href="./css/edit.css">
- <link rel="stylesheet" href="./editor.md/css/editormd.min.css">
- head>
- <body>
- <div class="导航栏">
- <div class="导航栏左边">
- <div class="logo-shell">
- <img class="logo" src="./img/logo.jpg">
- div>
- 我的博客系统
- div>
- <div class="导航栏右边">
- <a href="/List.html">主页a>
- <a href="/edit.html">写博客a>
- <a href="/login.html">注销a>
- div>
- div>
- <div class="下面区域">
-
-
- <form method="post" action="/edit.do">
- <div class="首行" >
- <input type="text" name="title" placeholder="博客标题">
- <input type="text" name="category" placeholder="博客分类">
- <button class="按钮" >发布文章button>
- div>
- <div class="editor" id="编辑器">
-
- div>
- form>
- div>
- <script src="./js/jquery.min.js">script>
- <script src="./editor.md/lib/marked.min.js">script>
- <script src="./editor.md/lib/prettify.min.js">script>
- <script src="./editor.md/editormd.js">script>
- <script>
- // 初始化编辑器
- let editor = editormd("编辑器", {
- // 这里的尺寸必须在这里设置. 设置样式会被 editormd 自动覆盖掉.
- width: "100%",
- // 高度 100% 意思是和父元素一样高. 要在父元素的基础上去掉标题编辑区的高度
- height: "calc(100% - 50px)",
- // 编辑器中的初始内容
- markdown: "# 在这里写下一篇博客",
- // 指定 editor.md 依赖的插件路径
- path: "./editor.md/lib/"
- });
- script>
- body>
- html>
- @import "NavigationBar.css";
-
- .下面区域{
- width: 1200px;
- min-height: calc(100vh - 50px);
- margin: 8px auto;
- }
-
- .下面区域 form{
- width: 100%;
- height: 100%;
-
- display: flex;
- flex-direction: column;
- align-items: stretch;
- justify-content: space-between;
- gap: 12px;
- }
-
- .下面区域 form .首行 input{
- width: 300px;
- border: none;
- outline: none;
- height: 30px;
- line-height: 30px;
- }
-
- .下面区域 form .首行{
- display: flex;
- justify-content: space-between;
- align-items: stretch;
- }
-
- .下面区域 form .editor{
- min-height: calc(100vh - 100px);
- }
-
- .下面区域 form .首行 input button{
- width: 220px;
- height: 30px;
- }
- .下面区域 form .首行 .按钮{
- background-color: #43d0d0;
- }
-

blog: 使用css+html做的简单博客页面https://gitee.com/ren-xiaoxiong/blog