题目一
通过浮动布局实现以下图片
题目二
通过浮动布局实现以下图案
题目一代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>浮动作业</title>
<style type="text/css">
.box{
width: 1000px;
margin: 0 auto;
}
div div{
font: 900 30px/100px 'STSong';
color: #fff;
text-align: center;
width: 200px;
height: 100px;
background-color: green;
float: left;
}
.b6 {
width: 600px;
background-color: yellow;
}
.b7{
width: 400px;
height: 200px;
line-height: 200px;
background-color: yellowgreen;
float: right;
}
.b8{
width: 300px;
height: 150px;
line-height: 150px;
background-color: #ebebeb;
float: left;
}
.b9{
width: 300px;
height: 150px;
line-height: 150px;
background-color: #000;
float: left;
}
.b10{
width: 400px;
height: 150px;
line-height: 150px;
background-color: cyan;
float: right;
}
.b11{
width: 600px;
height: 100px;
line-height: 100px;
background-color: red;
}
.b12{
width: 1000px;
background-color: blue;
}
</style>
</head>
<body>
<div class="box">
<div class="b1">1</div>
<div class="b2">2</div>
<div class="b3">3</div>
<div class="b4">4</div>
<div class="b5">5</div>
<div class="b6">6</div>
<div class="b7">7</div>
<div class="b8">8</div>
<div class="b9">9</div>
<div class="b10">10</div>
<div class="b11">11</div>
<div class="b12">12</div>
</div>
</body>
</html>
题目二代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>作业2</title>
<style type="text/css">
.box{
width: 600px;
margin: 0 auto;
}
.l, .m , .r{
width: 200px;
float: left;
}
.l div, .r div {
background-color: red;
height: 190px;
}
.m div {
background-color: yellow;
height: 290px;
}
div div div:not(:first-child){
margin-top: 10px;
}
</style>
</head>
<body>
<div class="box">
<div class="l">
<div></div>
<div></div>
<div></div>
</div>
<div class="m">
<div></div>
<div></div>
</div>
<div class="r">
<div></div>
<div></div>
<div></div>
</div>
</div>
</body>
</html>