html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./static/font/iconfont.css">
<link rel="stylesheet" href="./work.css">
<title>12月20作业</title>
</head>
<body>
<div class="body">
<div class="top">
<!-- logo -->
<div class="log">
<a href=""><img src="./static/images/logo.png" alt=""></a>
</div>
<!-- input-search -->
<div class="search">
<input type="search" id="search">
<label for="search" class="iconfont icon-jinduchaxun"></label>
</div>
<!-- 快捷导航 -->
<div class="quit-nav">
<em class="iconfont icon-huiyuan1"></em>
<em class="iconfont icon-huiyuan1"></em>
<em class="iconfont icon-huiyuan1"></em>
<em class="iconfont icon-huiyuan1"></em>
<em class="iconfont icon-huiyuan1"></em>
<em class="iconfont icon-huiyuan1"></em>
</div>
</div>
<div class="nav">
<div class="nav-item">
<em class="iconfont icon-DOC"></em>
<div class="nav-item-child1">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
<div class="nav-item-child2">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
</div>
<div class="nav-item">
<em class="iconfont icon-DOC"></em>
<div class="nav-item-child1">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
<div class="nav-item-child2">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
</div>
<div class="nav-item">
<em class="iconfont icon-DOC"></em>
<div class="nav-item-child1">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
<div class="nav-item-child2">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
</div>
<div class="nav-item">
<em class="iconfont icon-DOC"></em>
<div class="nav-item-child1">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
<div class="nav-item-child2">
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
<a href=""><span>好好</span></a>
<a href=""><span>学习</span></a>
</div>
</div>
</div>
<div class="bottom">
<div class="bottom-1">
<img src="./static/images/1.jpg" alt="">
</div>
<div class="bottom-right">
<img src="./static/images/banner-right.jpg" alt="">
</div>
</div>
</div>
</body>
</html>
css代码
/* 初始化 */
*{
margin: 0;
padding: 0;
/* outline: 1px dashed lightcoral; */
}
a{
color: lightgreen;
font-size: 13px;
/* 去掉下划线 */
text-decoration: none;
}
.body{
width: 1200px;
min-height: 300px;
margin: 30px auto;
}
.body > *{
margin-bottom: 20px;
}
/* 最上面的div top */
.body > .top{
height: 70px;
position: relative;
}
.body > .top *{
height: inherit;
line-height: 70px;
}
/* log 图片 */
.body > .top > .log{
width: 176px;
position: absolute;
left:0;
top: 0;
}
/* 搜索框 */
.body > .top > .search{
width: 330px;
position: absolute;
top: 0;
right:350px;
}
.body > .top > .quit-nav{
width: 300px;
position: absolute;
top: 0;
right: 0;
}
.body > .top > .log img{
height: 100%;
display: block;
}
/* 搜索框 */
.body > .top > .search input[type='search']{
width: 330px;
height: 36px;
border-radius: 10px;
padding: 10px;
}
.body > .top > .search input[type='search']:hover{
box-shadow: 0 0 5px rosybrown;
}
.body > .top > .search input[type='search'] + label{
font-size: 24px;
margin-left: -30px;
position: relative;
top: 5px;
right: 10px;
}
.body > .top > .quit-nav > em{
font-size: 35px;
margin-right: 10px;
}
.body > .top > .quit-nav > em:hover{
color:red;
cursor: pointer;
}
/* 中间导航区 */
.body > .nav{
height: 45px;
}
.body > .nav > .nav-item{
width: 300px;
height: inherit;
position: relative;
float: left;
}
.body > .nav > .nav-item em{
color: red;
font-size: 40px;
position: absolute;
}
.body > .nav > .nav-item > .nav-item-child1{
width: 40px;
position: absolute;
left: 46px;
border-right: 1px solid #cccccc;
}
.body > .nav > .nav-item > .nav-item-child2{
width: 160px;
position: absolute;
right:30px;
}
.body > .nav > .nav-item > .nav-item-child2 a{
margin-left: 5px;
}
.body > .nav > .nav-item > .nav-item-child2 a:hover{
color: red;
text-decoration: rosybrown;
}
.body > .bottom {
height: 320px;
position: relative;
}
.body > .bottom > .bottom-1{
width: 895px;
position: absolute;
display: block;
}
.body > .bottom > .bottom-right{
width: 300px;
position: absolute;
display: block;
right:0;
}
效果展示
总结心得
在老师没有讲布局之前,自己对布局大概就是一塌糊涂,只知道一点零零散散的知识点,老师讲完之后,心里大概有一个布局的大致思路, 1、先将页面总体的大架子搭出来; 2、在把架子中的小架子搭建出来 3、在对小架子里面的东西进行样式调整。
感觉对前端的反感,渐渐没有了。
谢谢老师。