分析如下
实现代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- 主页面 -->
<div class="container">
<!-- 头部 -->
<div class="page-hear clearfix">
<div class="logo leftfix">logo</div>
<div class="banner1 leftfix">banner1</div>
<div class="banner2 leftfix">banner2</div>
</div>
<!-- 菜单 -->
<div class="menu">菜单</div>
<!-- 内容 -->
<div class="content clearfix">
<!-- 左边内容区 -->
<div class="left leftfix">
<div class="top clearfix">
<div class="item1 leftfix">栏目一</div>
<div class="item2 leftfix">栏目二</div>
</div>
<div class="bottom clearfix">
<div class="item3 leftfix">栏目三</div>
<div class="item4 leftfix">栏目四</div>
<div class="item5 leftfix">栏目五</div>
<div class="item6 leftfix">栏目六</div>
</div>
</div>
<!-- 右边内容区 -->
<div class="right leftfix">
<div class="item7">栏目七</div>
<div class="item8">栏目八</div>
<div class="item9">栏目九</div>
</div>
</div>
<!-- 页脚 -->
<div class="footer">页脚</div>
</div>
</body>
</html>
<style>
*{
margin: 0;
padding: 0;
}
.leftfix{
float: left;
}
.clearfix::after{
content: "";
display: block;
clear: both;
}
.container{
width: 960px;
margin: 0 auto;
text-align: center;
}
.logo,.banner2{
height: 80px;
width: 200px;
background-color: #ccc;
line-height: 80px;
}
.banner1{
height: 80px;
width: 540px;
background-color: #ccc;
margin: 0 10px;
line-height: 80px;
}
.menu{
background-color: #ccc;
margin: 10px 0;
width: 960px;
height: 30px;
line-height: 30px;
}
.item1,.item2{
border: 1px black solid;
height: 200px;
width: 368px;
margin-right: 10px;
line-height: 200px;
}
.item3,.item4,.item5,.item6{
border: 1px black solid;
width: 178px;
height: 200px;
margin-right: 10px;
line-height: 200px;
margin-top: 10px;
}
.item7,.item8,.item9{
border: 1px black solid;
width: 198px;
height: 130px;
line-height: 130px;
}
.item8{
margin: 10px 0;
}
.footer{
margin-top: 10px;
background-color: #ccc;
height: 60px;
width: 960px;
line-height: 60px;
}
</style>
标签:浮动,栏目,布局,练习,height,width,10px,line,margin
From: https://www.cnblogs.com/liuguangshuo/p/17992993