CSS——清除浮动

 

<div id="main" class="clear">

  <div id="left">

  </div>

  

  <div id="right">

  </div>

</div>

 

<div id="other">

</div>

/*-----------------------------------------------*/

#main{

backgroud-color:#aaa;

padding:10px;

}

#left{

background-color:#bbb;

padding:5px;

border:1px solid red;

width:100px;

height:100px;

float:left;

}

#right{

background-color:#ccc;

padding:5px;

border:1px solid red;

width:100px;

height:100px;

float:left;

border:1px solid red;

float:right;

}

 

.clear:after{

 content:".";

height:0;

visibility:hidden;

display:both;

clear:both;

}

posted @ 2014-11-14 16:54  darknoll  阅读(127)  评论(1编辑  收藏  举报