老师,您好,我清除了浮动,那dl应该在main里,给main加边框只包含了h2标题,是为什么?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS布局</title>
<style type="text/css">
/*此处写代码*/
*{margin: 0;padding: 0;}
.main{
width: 1200px;
margin: 0 auto;
overflow: hidden;
zoom:1;
border: 1px red solid;
}
.main h2{
text-align: center;
margin: 10px 0;
}
.main .content{
position: absolute;
left: 50%;
margin-left: -456px;
}
.main dl{
float: left;
margin: 0 15px;
}
.main dl dd{
width: 426px;
}
</style>
</head>
<body>
<!-- 此处写代码 -->
<div class="main">
<h2>ENJOY THE LIFE</h2>
<div class="content">
<dl>
<dt>
<img src="http://img1.sycdn.imooc.com/climg//58f829090001a4b504260240.jpg">
</dt>
<dd>
<p>Life is like a book, just read aort and more refined, more write more careful ly. When read, mind open, all things have been indi fferent to heart. Life is the precipitation.</p>
</dd>
</dl>
<dl>
<dt>
<img src="http://img1.sycdn.imooc.com/climg//58f8290f0001558804260240.jpg">
</dt>
<dd>
<p>Life is like a cup of tea, just read aort and more refined, more write more careful ly. When read, mind open, all things have been indi fferent to heart. Life is the precipitation.</p>
</dd>
</dl>
</div>
</div>
</body>
</html>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星