【静态网页制作大作业——个人博客搭建(HTML+CSS+Javascript)】


作品介绍

网页作品简介: 寒假期间学习HTML和CSS即部分Javascript后的第一个大作业,搭建一个个人静态博客,后面出于兴趣,将其部署到GitPage上并利用GitHub添加了留言功能。


一、作品展示

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、代码实现

代码如下(示例):

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Li Shu's site</title>
		<link href="img/title.ico" rel="shortcut icon"/>
		<style type="text/css">
			html{
				position: relative;
			}
			.top{
				background-color: #FFFFFF;
				height: 60px;
				width: 1900px;
				position: absolute;
				top: 0;
				left: 0;
			}
			.top h1{
				padding-left: 150px;
				font-family: "华文新魏";
			}
			.top-left{
				width: 250px;
				height: 50px;
			}
			.top-left span{
				position: absolute;
				top: 15px;
				left: 250px;
				font-family: "华文新魏";
				font-size: 28px;
				color: pink;
				float: left;
				display: none;
			}
			.top-left:hover span{
				display: block;
			}
			.top1{
				position: absolute;
				top: 0px;
				left: 600px;
				padding: 20px;
				font-family: "华文新魏";
				font-size: 30px;
			}
			.top2{
				position: absolute;
				top: 0px;
				left: 800px;
				padding: 20px;
				font-family: "华文新魏";
				font-size: 30px;
			}
			.top3{
				position: absolute;
				top: 0px;
				left: 1050px;
				padding: 20px;
				font-family: "华文新魏";
				font-size: 30px;
			}
			.top4{
				position: absolute;
				top: 0px;
				left: 1300px;
				padding: 20px;
				font-family: "华文新魏";
				font-size: 30px;
			}
			a{
				text-decoration: none;
				color: black;
			}
			a:hover{
				text-decoration: none;
				color:  orange;
			}
			a:active{
				text-decoration: line-through;
				color: cadetblue;
			}
			.top-right{
					position: absolute;
					top: 0px;
					right: 30px;
					padding: 20px;
					font-family: "华文新魏";
					font-size: 20px;
			}
			.top img{
				width: 40px;
				height: 40px;
				border-radius: 25px;
				position: absolute;
				top: 5px;
				right: 0px;
			}
			.top-right1{
					position: absolute;
					top: -4px;
					right: -150px;
					padding: 20px;
			}
			.top-right1 input{
				font-family: "华文新魏";
				font-size: 20px;
				border-radius: 8px;
			}
			.main{
				position: absolute;
				top: 60px;
				left: 0;
				background-image: url(img/人生背景.jpg);
				background-repeat: no-repeat;
				background-size: cover;
				background-attachment: fixed;
				width: 2133px;
				height: 1141px;
			}
			.main-left h1{
				position: absolute;
				left: 50px;
				top: 180px;
				color: #517693;
				font-size: 40px;
				font-weight: bold;
				font-family: "华文行楷";
			}
			.main-left h3{
				position: absolute;
				left: 50px;
				top: 280px;
				color: #517693;
				font-size: 28px;
				font-weight: bold;
				font-family: "华文行楷";
			}
			.center-left{
				position: absolute;
				top: 30px;
				left: 550px;
				width: 250px;
				height: 850px;
				border: 3px solid white;
				border-radius: 20px;
				background-color:white;
				opacity: 0.8;
			}
			.center-left img{
				width: 100px;
				height: 100px;
				border-radius: 100px;
				position: absolute;
				top: 5px;
				left: 75px;
			}
			.center-left #name{
				position: absolute;
				top: 110px;
				left: 75px;
				text-align: center;
				font-family: "华文新魏";
				font-size: 17px;
			}
			.span ul{
				position:absolute;
				top: 200px;
				left: 510px;
				width: 250px;
				height: 680px;
			}
			.span li{
				line-height: 111px;
				list-style-type: none;
			}
			.pane{
				width: 256px;
				text-align: center;
				font-family: "华文新魏";
				font-size: 20px;
			}
			.pane:hover{
				background-color: white;
			}
			.pane1{
				width: 256px;
				height: 114px;
				border-bottom-left-radius: 15px;
				border-bottom-right-radius: 15px;
				text-align: center;
				font-family: "华文新魏";
				font-size: 20px;
			}
			.pane1:hover{
				background-color: white;
			}
			.center{
				position: absolute;
				top: 30px;
				left: 820px;
				width: 850px;
				height: 850px;
				border: 3px solid white;
				border-radius: 20px;
				background: rgba(250,250,250,0.8);
			}
			.center iframe{
				border-radius: 20px;
			}
			#showtime1{
					position: absolute;
					left: 30px;
					bottom: 20px;
					color: #517693;
					font-size: 28px;
					font-weight: bold;
					font-family: "华文新魏";
					}
			#showtime2{
					position: absolute;
					left:40px;
					bottom: -15px;
					color: #517693;
					font-size: 25px;
					font-weight: bold;
					font-family: "华文新魏";
					}
			.time{
				position: absolute;
				right: 30px;
				bottom: 5px;
				color: #517693;
				font-size: 28px;
				font-weight: bold;
				font-family: "华文新魏";
				}
			.bottom
			{
				position: absolute;
				top: 1110px;
				width: 2110px;
				height: 85px;
			}
		</style>
	</head>
	<body>
		<div class="top">
			<div class="top-left">
				<h1>止于此</h1>
				<span>风止于秋水,我止于你💗</span>
			</div>
			<a class="top1" href="home page.html">首页</a>
			<a class="top2" href="work.html">苦海无涯</a>
			<a class="top3" href="life.html">人生旅途</a>
			<a class="top4" href="message board.html">人生良言</a>
			<span class="top-right">黎曙</span>
			<img src="img/头像.jpg" title="头像" alt="头像" />
			<span class="top-right1"><input type="submit" value="登录"></span>
		</div>
		<div class="main">
			<div class="main-left">
				<h1>欢迎来到黎曙的世界!<br/>Welcome to Li Shu's world!</h1>
				<h3>今天也要加油昂!<br/>Today, we still have to refuel!</h3>
			</div>
			<div class="main-center">
				<div class="center-left">
					<a href="my.html" target="frame"><img src="img/头像.jpg" alt="头像" title="头像" /></a>
					<span id="name">黎曙<br/>非常热爱生活</span>
				</div>
			</div>
				<div class="span">
						<ul>
							<li class="pane"><a href="main1.html" target="frame">主页</a></li>
							<li class="pane"><a href="work.html" target="frame">笔记</a></li>
							<li class="pane"><a href="conclude.html" target="frame">归档</a></li>
							<li class="pane"><a href="email.html" target="frame">邮箱</a></li>
							<li class="pane"><a href="about.html" target="frame">关于</a></li>
							<li class="pane1">更多</li>
						</ul>
				</div>
				<div class="center">
					<iframe src="main1.html" width="850px" height="850px" frameborder="0" scrolling="yes" name="frame"></iframe>
				</div>
			</div>
		<div class="bottom">
			<p id="showtime1" title="我们的征途是星辰大海">哈雷彗星的约定:</p>
			<p id="showtime2" >141933:22:55</p>
			<script>
				var showtime2 = function () {
					var nowtime = new Date();
						endtime = new Date("2061/1/1");
					var lefttime = endtime.getTime() - nowtime.getTime();
						leftd = Math.floor(lefttime/(1000*60*60*24));  
						lefth = Math.floor(lefttime/(1000*60*60)%24);  
						leftm = Math.floor(lefttime/(1000*60)%60);  
						lefts = Math.floor(lefttime/1000%60); 
					return leftd + "&#22825;" + lefth + ":" + leftm + ":" + lefts;
				}
				var div = document.getElementById("showtime2");
				setInterval (function () {
					div.innerHTML = showtime2();
				}, 1000);
			</script>
			<div class="time">
				<script> 
					document.write("<span id=time></span>") 
					setInterval("time.innerText=new Date().toLocaleString()",1000)
				</script> 
			</div>
		</div>
	</body>
</html>

预览地址

[网站预览地址](https://ylishu.github.io/)

总结

以上就是今天要讲的内容,本文仅仅简单介绍了个人静态博客,而部署个人静态博客基本上是所有前端开发者必经的一个阶段。

  • 81
    点赞
  • 534
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 11
    评论
好的,以下是一个简单的 HTML+CSS 网页,展示了一道美食的详细信息,包括名称、图片、材料和做法等内容。 ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>美食制作</title> <style> body { font-family: Arial, sans-serif; } h1 { text-align: center; margin-top: 40px; } .container { width: 80%; margin: 0 auto; display: flex; flex-direction: column; align-items: center; } img { width: 100%; max-width: 400px; height: auto; margin-bottom: 20px; } .ingredients { margin-left: 20px; margin-bottom: 20px; } .instructions { margin-left: 20px; margin-bottom: 40px; } </style> </head> <body> <h1>红烧肉</h1> <div class="container"> <img src="https://www.xiachufang.com/wp-content/uploads/2021/04/69f7d0b1-5a04-4dbd-9aa1-db5ae6f7b5cc.jpg?imageView2/2/w/620/interlace/1/q/90" alt="红烧肉"> <p class="ingredients">材料:</p> <ul> <li>五花肉 500 克</li> <li>葱段 2 段</li> <li>姜片 5 片</li> <li>料酒 50 毫升</li> <li>老抽 50 毫升</li> <li>生抽 50 毫升</li> <li>冰糖 30 克</li> <li>八角 2 颗</li> <li>香叶 3 片</li> <li>水 适量</li> </ul> <p class="instructions">做法:</p> <ol> <li>肉切块,焯水去血水,捞出备用。</li> <li>锅中加少许油,放入葱姜爆香,加入糖炒至溶化。</li> <li>加入肉块煸炒至表面微黄。</li> <li>加入料酒、老抽、生抽、八角、香叶和适量的水,烧开后转小火煮 1-1.5 小时,至肉变软入味。</li> <li>收汁,翻炒均匀即可。</li> </ol> </div> </body> </html> ``` 这个网页中,我们使用了 `<img>` 标签来插入一张美食图片,使用了 `<ul>` 和 `<li>` 标签来展示材料清单,使用了 `<ol>` 和 `<li>` 标签来展示做法步骤。通过 CSS 样式对网页进行美化,使其更加美观易读。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

黎子想写好代码

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

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

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

打赏作者

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

抵扣说明:

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

余额充值