好久不见喽,今天带来一个我的Web作业,虽然说这个作业不是特别的难,但是里面涉及到的知识点真的还蛮多的,而且对于代码的整齐度阿,代码整体的流畅度我个人感觉真的得到了一定的提升,所以多大代码、多想、多做就没错啦,这篇博客比较长,但扯到很多的知识点,喜欢的话收藏一波啦,篇章二的传送门在这里:快乐星球
效果图
这个效果是动态的,只是这里我就只是截个图,所以看不到🙉🙉
划分区域
在完成这个作业、这个任务之前,我习惯性会将这个页面上的东西进行划分,分为“块”,然后再继续操作,稳稳地
分好之后我们就开始敲代码喽
打框架🐐
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blog</title>
<style type="text/css">
</style>
</head>
<body>
<div id="parent">
<div id="container">
<div id="header"></div>
<div id="nav"></div>
<div id="content"></div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
背景+头部
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blog</title>
<style type="text/css">
body{
font-size: 12px;
color: #f46490;
background: url("./images/background.jpg") repeat;
padding: 0;
}
#parent {
width: 100%;
height:100%;
background:url("./images/fl.gif") no-repeat;
background-size: cover;
background-attachment: fixed;
}
#container {
width: 867px;
height: auto;
margin: 0 auto;
}
#header{
width: 867px;
height: 408px;
}
</style>
</head>
<body>
<div id="parent">
<div id="container">
<div id="header">
<img src="./images/top.gif" alt="">
</div>
<div id="nav"></div>
<div id="content"></div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
效果图
导航栏
这次的导航栏用到的是—.>导航栏背景是图片这种做法,然后在这里我想说明一下在ul里设置的padding和在li上设置的padding的区别和不同:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blog</title>
<style type="text/css">
body{
font-size: 12px;
color: #f46490;
background: url("./images/background.jpg") repeat;
padding: 0;
}
#parent {
width: 100%;
height:100%;
background:url("./images/fl.gif") no-repeat;
background-size: cover;
background-attachment: fixed;
}
#container {
width: 867px;
height: auto;
margin: 0 auto;
}
#header{
width: 867px;
height: 408px;
}
#nav{
width: 867px;
height: 30px;
position: relative;
background: url("./images/nav.gif") no-repeat;
margin: 0 auto;
}
#nav ul{
height: 30px;
list-style-type: none;
margin: 0 auto;
padding: 0 0 0 80px;
}
#nav ul li{
width: 65px;
height: 30px;
float: left;
padding: 0 20px;
}
#nav ul li a {
color: #f46490;
font-weight: bold;
font-size: 12px;
line-height: 30px;
text-decoration: none;
display: inline-block;
}
a:hover{
color: #666;
}
</style>
</head>
<body>
<div id="parent">
<div id="container">
<div id="header">
<img src="./images/top.gif" alt="">
</div>
<div id="nav">
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">相册</a></li>
<li><a href="#">个人</a></li>
<li><a href="#">档案</a></li>
<li><a href="#">好友</a></li>
<li><a href="#">留言板</a></li>
<li><a href="#">我的音乐</a></li>
</ul>
</div>
<div id="content"></div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
效果图
我们篇章二见噢~~
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)