CSS 2-14编程练习
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.top {
width: 70%;
height: 400px;
margin: 0 auto;
background: #9BE3FF;
}
.top .left {
position: relative;
float: left;
width: 50%;
height: 100%;
line-height: 500px;
}
.top .right {
position: relative;
float: right;
width: 50%;
height: 100%;
}
.top img {
position: absolute;
top: 50%;
margin-top: -107px;
left: 50%;
margin-left: -180px;
}
.bottom {
width: 70%;
height: 300px;
margin: 0 auto;
background: #FFC0CB;
}
.bottom .left {
position: relative;
float: left;
width: 33.3%;
height: 100%;
}
.bottom .middle {
position: relative;
float: left;
width: 33.3%;
height: 100%;
}
.bottom .right {
position: relative;
float: left;
width: 33.3%;
height: 100%;
}
.bottom img {
position: absolute;
top: 50%;
margin-top: -30px;
left: 50%;
margin-left: -100px;
}
</style>
</head>
<body>
<div class="top">
<div class="left">
<img src="http://img1.sycdn.imooc.com/climg//58c0f808000129a303600215.jpg">
</div>
<div class="right">
<img src="http://img1.sycdn.imooc.com/climg//58c0f819000198a703600214.jpg">
</div>
</div>
<div class="bottom">
<div class="left">
<img src="http://img1.sycdn.imooc.com/climg//58c0f81d0001fe4402000060.jpg">
</div>
<div class="middle">
<img src="http://img1.sycdn.imooc.com/climg//58c0f8220001dfce02000060.jpg">
</div>
<div class="right">
<img src="http://img1.sycdn.imooc.com/climg//58c0f8780001c74602000060.jpg">
</div>
</div>
</body>
</html>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星