<div class="wrap"> <h2>1)添加额外标签</h2> <div class="box1 left">box1 float:left;</div> <div class="box2 left">box2 float:left;</div> <div style="clear:both;"></div> <!-- <div style="clear:left;"></div> <div style="clear:right;"></div> --> </div> <div class="footer">.footer</div>
.box1{ height:100px; background:#99FF33; } .box2{ height:100px; background:#FF99FF; } .left{ float:left; } .right{ float:right; } .wrap{ border:solid 1px black; } .footer{ background:lightblue; }