【Web 三件套】个人简单博客系统页面搭建(附源码)

1. 成品展示

以下为个人搭建的一个简单博客系统页面,以后会不断改进,并且与后端结合,形成一个完整的博客系统

在这里插入图片描述

2. 知识准备

该博客系统页面是由 HTML + CSS + JavaScript 搭建的,如果没有了解过这些知识的友友,可以通过本人之前写好的几篇相关文章入门

3. 博客系统页面搭建

3.1 基本介绍

该博客系统页面现由4个部分组成,分别为:博客列表页、博客详情页、博客登录页、博客编辑页

针对每个页面后面都会进行页面和代码的展示,并且代码中含有个人的注释。为了方便下载使用,下面附上该博客系统页面的 Gitee 链接

Gitee 链接: https://gitee.com/bbbbbge/blog-system

3.2 博客列表页

页面展示:

image-20220218063339426

页面元素 HTML 代码: blog_list.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客列表页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/blog_list.css">
</head>
<body>
    <!-- 导航栏 -->
    <div class="nav">
        <img src="image/log.png" alt="">
        <span class="title">我的博客系统</span>
         <!-- 使用 span 把左右两侧的元素给撑开 -->
         <span class="spacer"></span>
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <a href="blog_login.html">注销</a>
    </div>
    <!-- 版心 -->
    <div class="container">
        <!-- 左侧区域,显示用户信息 -->
        <div class="container-left">
            <!-- 用户详情 -->
            <div class="card">
                <!-- 用户的头像 -->
                <img src="image/head.jpg" alt="">
                <!-- 用户名 -->
                <h3>吞吞吐吐大魔王</h3>
                <!-- 其它信息 -->
                <a href="https://blog.csdn.net/weixin_51367845?type=blog">CSDN 地址</a>
                <a href="#">GitHub 地址</a>
                <!-- 文章分类 -->
                <div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>
                <div class="counter">
                    <span>2</span>
                    <span>1</span>
                </div>
            </div>
        </div>
        <!-- 右侧区域,显示博客列表 -->
        <div class="container-right">
            <!-- 每个 blog 代表一篇博客 -->
            <div class="blog">
                <div class="title">第一篇博客</div>
                <div class="date">2022-2-16</div>
                <div class="desc">
                    中国人的性情是喜欢调和折中的,譬如你说,这屋子太暗,须在这里开一个窗,大家一定不允许的。但如果你主张拆掉屋顶他们就来调和,愿意开窗了。
                </div>
                <a href="blog_detail.html" class="detail">查看全文&gt;&gt;</a>
            </div>
            <div class="blog">
                <div class="title">第二篇博客</div>
                <div class="date">2022-2-16</div>
                <div class="desc">
                    中国人的性情是喜欢调和折中的,譬如你说,这屋子太暗,须在这里开一个窗,大家一定不允许的。但如果你主张拆掉屋顶他们就来调和,愿意开窗了。
                </div>
                <a href="blog_detail.html" class="detail">查看全文&gt;&gt;</a>
            </div>
        </div>
    </div>
</body>
</html>

专属页面样式 CSS 代码: blog_list.css

/* 这个 CSS 专门针对博客列表页来设置样式 */

.blog {
    width: 100%;
    padding: 10px 20px;
}

/* 博客的标题 */
.blog .title {
    text-align: center;
    font-size: 25px;
    font-weight: 700;
    padding-top: 10px;
    padding-bottom: 5px;
}

/* 博客的日期 */
.blog .date {
    text-align: center;
    padding-bottom: 10px;
    color: grey;
}

/* 博客的描述 */
.blog .desc {
    text-indent: 2em;
}

/* 查看博客详情的按钮 */
.blog .detail {
    display: block;
    width: 120px;
    color: grey;
    height: 30px;
    /* 设置边框 */
    border: 2px solid grey;
    /* 文字水平居中 */
    text-align: center;
    /* 文字垂直居中 */
    line-height: 30px;
    /* 去掉下划线 */
    text-decoration: none;
    /* 让按钮来到屏幕中间 */
    margin: 10px auto;
    /* 加上一个过度效果 */
    transition: all 1s;
}

/* 实现鼠标悬停在按钮上时有一个背景色切换的效果 */
.blog .detail:hover {
    background-color: grey;
    color: white;
}

3.3 博客详情页

页面展示:

image-20220218063356928

页面元素 HTML 代码: blog_detail.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客详情页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/blog_detail.css">
</head>
<body>
    <!-- 导航栏 -->
    <div class="nav">
        <img src="image/log.png" alt="">
        <span class="title">我的博客系统</span>
         <!-- 使用 span 把左右两侧的元素给撑开 -->
         <span class="spacer"></span>
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <a href="blog_login.html">注销</a>
    </div>
    <!-- 版心 -->
    <div class="container">
        <!-- 左侧区域,显示用户信息 -->
        <div class="container-left">
            <!-- 用户详情 -->
            <div class="card">
                <!-- 用户的头像 -->
                <img src="image/head.jpg" alt="">
                <!-- 用户名 -->
                <h3>吞吞吐吐大魔王</h3>
                <!-- 其它信息 -->
                <a href="https://blog.csdn.net/weixin_51367845?type=blog">CSDN 地址</a>
                <a href="#">GitHub 地址</a>
                <!-- 文章分类 -->
                <div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>
                <div class="counter">
                    <span>2</span>
                    <span>1</span>
                </div>
            </div>
        </div>
        <!-- 右侧区域,显示博客列表 -->
        <div class="container-right">
            <!-- 使用这个 div 来放博客内容 -->
            <div class="blog-content">
                <!-- 博客的标题 -->
                <h3>我的第一篇博客</h3>
                <!-- 博客的日期 -->
                <div class="date">2022-2-16</div>
                <!-- 博客的内容 -->
                <div class="detail">
                    <p>
                        中国人的性情是喜欢调和折中的,譬如你说,这屋子太暗,须在这里开一个窗,大家一定不允许的。但如果你主张拆掉屋顶他们就来调和,愿意开窗了。
                    </p>
                    <p>
                        而忽而这些都空虚了,但有时故意地填以没奈何的自欺的希望。希望,希望,用这希望的盾,抗拒那空虚中的暗夜的袭来,虽然盾后面也依然是空虚中的暗夜。
                    </p>
                    <p>
                        如果痛苦换来的是结识真理、坚持真理,就应自觉的欣然承受,那时,也只有那时,痛苦穿掘着灵魂的深处,使人受了精神底苦刑而得到创伤,又即从这得伤和养伤和愈合中,得到苦的涤除,而上了苏生的路。
                    </p>
                    <p>
                        当我沉默着的时候,我觉得充实;我将开口,同时感到空虚。过去的生命已经死亡。我对于这死亡有大欢喜,因为我借此知道它曾经存活。死亡的生命已经朽腐。我对于这朽腐有大欢喜,因为我借此知道它还非空虚。
                    </p>
                </div>
        </div>
</body>
</html>

专属页面样式 CSS 代码: blog_detail.css

/* 这个 CSS 文件是用来放博客详情页的专属样式 */

.blog-content {
    padding: 30px;
}

/* 博客标题 */
.blog-content h3 {
    text-align: center;
    padding-top: 40px;
    padding-bottom: 20px;
    font-size: 25px;
}

/* 博客日期 */
.blog-content .date {
    text-align: center;
    padding-bottom: 10px;
    color: grey;
}

/* 博客内容 */
.blog-content p {
    text-indent: 2em;
    padding: 10px 0;
}

3.4 博客登录页

页面展示:

image-20220218063418585

页面元素 HTML 代码: blog_login.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/blog-login.css">
</head>
<body>
    <!-- 导航栏 -->
    <div class="nav">
        <img src="image/log.png" alt="">
        <span class="title">我的博客系统</span>
         <!-- 使用 span 把左右两侧的元素给撑开 -->
         <span class="spacer"></span>
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <a href="blog_login.html">注销</a>
    </div>
    <!-- 登录页面的版心 -->
    <div class="login-container">
        <div class="login-dialog">
            <h3>登录</h3>
            <div class="row1">
                <span>用户名</span>
                <input type="text" id="username">
            </div>
            <div class="row1">
                <span>密码</span>
                <input type="password" id="password">
            </div>
            <div class="row2">
                <input type="button" value="提交" id="submit">
            </div>
        </div>
    </div>
</body>
</html>

专属页面样式 CSS 代码: blog_login.css

/* 这个 CSS 文件是放登陆页面的专属样式 */

/* 1. 设置版心,让这个版心将页面填充满 */
/* 2. 在版心中间位置,设置一个登陆区域 */
.login-container {
    width: 100%;
    height: calc(100% - 50px);

    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container .login-dialog {
    width: 400px;
    height: 280px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
}

.login-dialog h3 {
    text-align: center;
    padding: 30px;
    font-size: 25px;
}

.login-dialog .row1 {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-dialog .row2 {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 30px;
}

.login-dialog .row1 span {
    width: 80px;
    font-weight: 700;
}

.login-dialog .row1 input {
    width: 200px;
    height: 30px;
    font-size: 15px;
    padding-left: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    /* 去掉边框 */
    border: none;
    /* 去掉轮廓线(选中输入框时,外面的黑边) */
    outline: none;
}

.login-dialog .row2 input {
    width: 280px;
    height: 35px;
    border-radius: 8px;
    font-size: 20px;
    background-color: rgba(41, 83, 149, 0.7);
    border: none;
}

.login-dialog .row2 input:active {
    background-color: black;
    color: white;
}

3.5 博客编辑页

页面展示:

image-20220218063453188

页面元素 HTML 代码: blog_edit.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客编辑页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/blog_edit.css">
    <!-- 引入依赖 -->
    <link rel="stylesheet" href="editor.md-master/css/editormd.min.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="editor.md-master/lib/marked.min.js"></script>
    <script src="editor.md-master/lib/prettify.min.js"></script>
    <script src="editor.md-master/editormd.js"></script>
</head>
<body>
    <!-- 导航栏 -->
    <div class="nav">
        <img src="image/log.png" alt="">
        <span class="title">我的博客系统</span>
         <!-- 使用 span 把左右两侧的元素给撑开 -->
         <span class="spacer"></span>
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <a href="blog_login.html">注销</a>
    </div>
    <!-- 版心 -->
    <div class="blog-edit-container">
        <!-- 标题编辑区 -->
        <div class="title">
            <input type="text" placeholder="在这里写下文章标题" id="title">
            <input type="button" value="发布文章" id="submit">
        </div>
        <!-- 内容编辑区 -->
        <div id="editor">

        </div>
    </div>

    <script>
        // 初始化 editor.md
        let editor = editormd("editor", {
            // 这里的尺寸必须在这里设置,设置样式会被 editormd 自动覆盖
            width: "100%",
            // 设定编辑高度
            height: "500px",
            // 编辑页中的初始化内容
            markdown: "# 在这里写下一篇博客",
            //指定 editor.md 依赖的插件路径
            path: "editor.md-master/lib/"
        });
    </script>
</body>
</html>

专属页面样式 CSS 代码: blog_edit.css

/* 这个 CSS 文件放博客编辑的专属样式 */

/* 博客编辑页的版心 */
.blog-edit-container {
    width: 1000px;
    height: calc(100% - 50px);
    margin: 0 auto;
}

/* 标题编辑区 */
.blog-edit-container .title {
    margin-top: 20px;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.blog-edit-container .title #title {
    width: 795px;
    height: 50px;
    border-radius: 10px;
    padding-left: 20px;
    border: none;
    outline: none;
    background-color: rgba(41, 83, 149, 0.3);
    font-size: 15px;
}

.blog-edit-container .title #submit {
    width: 200px;
    height: 50px;
    border-radius: 10px;
    border: none;
    outline: none;
    background-color: rgba(255, 192 , 153, 0.4);
    font-size: 20px;
}

.blog-edit-container .title #submit:active {
    background-color: rgba(41, 83, 149, 0.3);
}

#editor {
    border-radius: 10px;
    border: none;
    opacity: 0.7;
}

3.6 公共页面样式

公共页面样式 CSS 代码: common.css

/* 这个文件里面放4个页面公共的一些样式,比如背景、导航栏等 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    /* 和父元素的一样高,body 的父亲是 html,html 的父亲是浏览器窗口 */
    height: 100%;
    /* 页面背景 */
    background-image: url(../image/background.jpg);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
} 

/* 导航栏 */
.nav {
    width: 100%;
    height: 50px;
    background-color: rgba(50, 50, 50, 0.2);
    color: #fff;
    display: flex;
    justify-content: start;
    align-items: center;
}

/* 导航栏中的 log */
.nav img {
    width: 40px;
    height: 40px;
    margin-left: 30px;
    margin-right: 10px;
}

/* 导航栏中的标题 */
.nav .title {
    width: 120px;
}

/* 导航栏中的占位符 */
.nav .spacer {
    height: 40px;
    width: calc(100% - 370px);
}

/* 导航栏中的链接 */
.nav a {
    width: 60px;
    margin: 20px;
    text-decoration: none;
    color: white;
}

/* 版心的样式 */
.container {
    height: calc(100% - 50px);
    width: 1000px;
    margin: 0 auto;
    /* 为了让版心里面的子元素能够以左右布局的方式显示,使用 flex 布局 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 左侧区域样式 */
.container .container-left {
    height: 100%;
    width: 200px;
}

/* 右侧区域样式 */
.container .container-right {
    height: 100%;
    width: 795px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
}

/* 用户信息卡片,也会在多个页面中用到 */
.card {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 30px;
}

/* 用户头像 */
.card img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
}

/* 用户名 */
.card h3 {
    text-align: center;
    padding: 10px 0;
}

/* 其它信息 */
.card a {
    /* a 标签是行内元素,设置尺寸、边距都可能失效,要转成块级元素 */
    display: block;
    text-decoration: none;
    text-align: center;
    color: grey;
    padding: 3px;
}

.card .counter {
    display: flex;
    justify-content: space-around;
    font-size: 15px;
    padding-top: 5px;
}

3.7 markdown 编辑器引入

在博客编辑页中含有一个 markdown 编辑器,这个是直接引入了一个叫 editor.md 的开源的页面 markdown 编辑器组件,大家也可以使用其它的编辑器组件

引入 editor.md 步骤:

  1. 下载 editor.md

    大家直接进入该项目的官网进行下载即可

    官网地址为:https://pandao.github.io/editor.md/

  2. 将下载好的 editor.md 接压缩到该博客项目中

    image-20220218071658835

  3. 在博客编辑页中引入 editor.md 依赖

    <!-- 引入依赖 -->
    <link rel="stylesheet" href="editor.md-master/css/editormd.min.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="editor.md-master/lib/marked.min.js"></script>
    <script src="editor.md-master/lib/prettify.min.js"></script>
    <script src="editor.md-master/editormd.js"></script>
    
  4. 在博客编辑页中,写个 JS 对 editor.md 进行初始化

    // 初始化 editor.md
    let editor = editormd("editor", {
        // 这里的尺寸必须在这里设置,设置样式会被 editormd 自动覆盖
        width: "100%",
        // 设定编辑高度
        height: "500px",
        // 编辑页中的初始化内容
        markdown: "# 在这里写下一篇博客",
        //指定 editor.md 依赖的插件路径
        path: "editor.md-master/lib/"
    });
    

通过以上步骤,就可以将 editor.md 该 markdown 编辑器引入我们的博客编辑页了

4. 总结

该博客系统页面只是运用前段时间学习的前端知识做出来的一个简单的页面,往后会通过不断的学习来对该博客系统进行补充,期待它的成品!

  • 155
    点赞
  • 759
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 61
    评论
个人博客系统源码下载个人博客系统源码下载 本项目基于ssh2+Oracle三大框架开发 项目需求概述 1.1. 概述 随着计算机技术的发展和普及,blog 得到了极大的发展。Blog,是 Weblog 的简称。blog 是一种新的生活方式、新的工作方式、新的学习方式和交流方式。本需求说明书的编写目的, 是为了描述本项目的需求背景,总结本项目需要完成的开发任务,从而便于系统分析人员和 开发人员在此基础上进行总体设计和详细设计,便于手册编写人员以此为指导编写用户手 册。 本需求说明书的预期读者为 SmartBlog 开发人员和测试人员。 1.2. 主要功能 SmartBlog 博客系统是一个简单博客系统,实现部分功能。主要提供管理用户(博主) 能够在指定分类下发表日志、对日志进行编辑和删除等功能。一般用户能够浏览日志,对日 志进行评论。日志管理和显示都需要提供分页功能。主要的功能划分为:首页模块、日志评 论模块、登录模块、后台管理模块,以下是各个模块的功能介绍: 序号 模块名称 主要功能 1 首页模块 显示博客的 LOGO 信息和主菜单,包括首页的链接, 登录(已登录用户显示后台管理和退出) 分页页显示 Java 分类下日志 提供日志评论功能 2 日志评论模块 对文章进行评论和评论显示 3 用户登录模块 提供用户登录功能,随机生成验证码验证 4 后台管理模块 提供日志的查询、删除、修改、新增功能 提供分页功能 1.3. 运行环境 1. 软件环境 分类 名称 版本 语种 操作系统 Windows XP 简体中文 数据库平台 Oracle10g 简体中文 北京阿博泰克北大青鸟信息技术有限公司 应用平台 Tomcat5.5 简体中文 客户端软件 动漫阅读器 APK 简体中文 Java 开发工具 Eclipse3.4 以上 框架 Spring+Struts2+Hibernate3 2. 硬件环境 开发电脑 最低配置 推荐配置 CPU:P4 2.0G  CPU:P4 2.8G 以上 内存:1G 内存:2G
搭建一个Java网上订餐系统可以分为以下几个步骤: 1. 系统设计:首先根据需求进行系统设计,包括功能需求、数据库设计、用户界面设计等。 2. 数据库搭建:使用MySQL等数据库创建一个用于存储订餐信息的数据库,包括菜单信息、用户信息、订单信息等。 3. 后端开发:使用Java开发后端程序,包括处理用户请求、操作数据库、生成订单、发送邮件等功能。可以使用Spring框架来简化开发,并使用MyBatis进行数据库操作。 4. 前端开发:使用HTMLCSSJavaScript前端技术,搭建用户界面。可以使用Bootstrap框架来快速搭建响应式界面。 5. 集成支付功能:集成支付功能,使用支付宝、微信支付等第三方支付方式,实现用户在线支付。 6. 测试与优化:对系统进行测试,包括功能测试、性能测试等,发现并修复问题,优化系统的性能和用户体验。 在搭建过程中,需要使用到一些常用的Java开发工具和技术,比如Eclipse、IntelliJ IDEA、Maven等。编写源码时,需要注意代码的规范性、易读性和可维护性,使用注释对代码进行说明,方便他人理解和修改。 最后,对于一个完整的网上订餐系统而言,仅靠300字的回答是无法详细解决所有问题的。搭建一个稳定、高效、安全的网上订餐系统需要一定的技术储备和经验积累。因此,建议在实际的开发过程中,更多地参考相关文档和教程,并积极与其他开发者进行交流和学习,从而更好地完成这个项目。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 61
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

吞吞吐吐大魔王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值