<div class="container">
  <div class="float"></div>
</div>
.container{
  border: 1px solid red;
/*  如果创建 BFC,就会把 float 元素的高度也计算在内  */
/*   overflow: hidden; */
}
.float{
  float: left;
  width: 100px;
  height: 100px;
  background: yellow;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.