清除浮动

清除浮动之clear:both

CSS:

.border{
  background: black;
}

.float{
  width: 100px;
  height: 100px;
  background: red;
  margin:20px 20px 20px 20px;
  float: right;

}

.clear{
  clear: both;
}

HTML:
<div class="border ">
  <div class="float">

  </div>
  <div class="clear"></div>
</div>

 

posted @ 2017-06-26 17:37  漫天风沙  阅读(110)  评论(0编辑  收藏  举报