网页中常见的排版 (关键点:浮动)

来源:互联网 发布:plc模拟编程手机版 编辑:程序博客网 时间:2024/05/21 15:03



排版格式如上。

考点:浮动,具体用法可参考http://www.w3school.com.cn/css/css_positioning_floating.asp

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="" content="" >
<meta name="" content="">
<!-- 真是懵逼了,meta标签没有结束标签 -->
<style>
*{
margin:0;
padding:0;
border:0;
}
.leftBox{
width:30px;
height:30px;
border:1px black solid;
float:left;
}
.rightBox{
width:300px;
height:100px;
border-bottom:1px black solid;
margin-bottom:10px;
margin-left:10px;
float:left;
}
.clear{
clear:both;
}
img{
width:50px;
height:50px;
margin-right:5px;
border:1px black solid;
float:left;
}

</style>
</head>
<body>
<div>
<div class="leftBox"></div>
<div class="rightBox">
<p>QQQQQQQQQQQQQQ</p>
<div >
<img src=""/>
<p>OOOOOOOOOOOO</p>
</div>
<p class="clear" >JJJJJJJJJJJJ</p>
</div>
<div class="clear"></div>
</div>

<div>
<div class="leftBox"></div>
<div class="rightBox">
<p>DDDDDDDDDDDDDDDD</p>
<div>
<img src=""/>
<p>WWWWWWWWWWWWWWW</p>
</div>
<p class="clear" >JJJJJJJJJJJJ</p>
</div>
<div class="clear"></div>
</div>
     </body>
</html>