css_清除浮动

这里只是说开发使用的清除浮动方法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

  <style type="text/css">

   .one1{
     height: 70px;
     width: 60px;
     background: greenyellow;
     float:left;

   }
   .one2{
     height: 90px;
     width: 100px;
     background: yellow;
     float: left;
   }
   .one3{
     height: 120px;
     width: 150px;
     background: #b3d4fc;
     /*float:left;*/
   }
  .box{
  width: 200px;
  /*height: 200px;*/
  background: #888888;
  /*float: left;*/
    /*overflow: hidden;*/
}

   .clearfix:after{
     content: "020";
     display: block;
     height: 0;
     clear: both;
     visibility: hidden;
   }

  </style>
    <title>Title</title>
</head>
<body>
//此处box的float 不要设置如果是下面有一个盒子。如果设置了就清除不了浮动了
<div class="clearfix box">  
  <div class="one1"> 1</div>
  <div class="one2"> 2</div>
</div>

<div class="one3">3 </div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/u010713935/article/details/88720346
今日推荐