利用所学的内容做了一个简单的布局

原创 2019-01-22 23:12:14 258
摘要:<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv=&

<!DOCTYPE html>

<html>


<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">

<style>

* {

margin: 0;

padding 0;

}


.header {

width: 100%;

height: 160px;

}


.header .logo {

margin: 0 auto;

width: 1200px;

height: 110px;

background-color: lightcoral;


}


.header .nav {

width: 100%;

height: 50px;

background-color: #029cff;

}


.header .nav .nav2 {

margin: 0 auto;

padding: 0;

width: 1200px;

}


.header .nav .item {

float: left;

width: 120px;

list-style: none;

line-height: 50px;

text-align: center;

color: #fff;


}


.header .nav .item:hover {

margin: 0 auto;

background-color: #fff;

color: #000;

}


.header .nav .item .nav3 {

display: none;

list-style: none;

border-left: 1px solid lightblue;

border-right: 1px solid lightblue;

border-bottom: 1px solid lightblue;

}


.header .nav .item:hover .nav3 {

width: 118px;

display: block;

background-color: #029cff;

padding-left: 0;

color: #fff;

}


.header .nav .item .nav3 .item2:hover {

background-color: #fff;

color: #000;

}


.clear {

clear: both;

}


.banner {

width: 100%;

height: 400px;

background-color: lightblue;

margin-top: 0px;

}


.container {

width: 1200px;

height: 268px;

margin: 30px auto;

}


.box {

float: left;

width: 276px;

height: 268px;

background-color: aqua;

}


.box1 {

float: left;

margin-left: 32px;

width: 276px;

height: 268px;

background-color: red;

}


.box2 {

float: left;

margin-left: 32px;

width: 276px;

height: 268px;

background-color: #000;

}


.box3 {

float: left;

margin-left: 32px;

width: 276px;

height: 268px;

background-color: lightcoral;

}


.footer {

width: 100%;

height: 100px;

background-color: #029cff;

}


.footer .content {

font-size: 18px;

text-align: center;

line-height: 100px;

color: #fff;

}

</style>

<title>我的站点</title>

</head>

<div class="header">

<div class="logo"></div>

<div class="nav">

<ul class="nav2">

<li class="item">网站首页</li>

<li class="item">关于我们

<ul class="nav3">

<li class=item2>公司简介</li>

<li class=item2>领导介绍</li>

</ul>

</li>

<li class="item">新闻中心</li>

<li class="item">产品介绍</li>

<li class="item">工程案例</li>

<li class="item">售后服务</li>

<li class="item">人才招聘</li>

<li class="item">在线留言</li>

<li class="item">销售网络</li>

<li class="item">联系我们</li>

</ul>

</div>

</div>


<div class="clear"></div>


<div class="banner"></div>


<div class="container">

<div class="box"></div>

<div class="box1"></div>

<div class="box2"></div>

<div class="box3"></div>

</div>


<div class="clear"></div>


<div class="footer">

<div class="content">这个是我的站点</div>

</div>


<body>


</body>


</html>


批改老师:天蓬老师批改时间:2019-01-23 08:59:17
老师总结:<div class="clear"></div>, 这种清浮动, 实际上用得并不多, 因为他会多增加一个dom元素, 可以用伪类:after来实现,更方便

发布手记

热门词条