<div class="box">
  <span class="rule1">浮动元素</span>
</div>
.box {
  background: #00ff90;
  padding: 10px;
  width: 500px;
  height: 150px;
}
.rule1 {
  float: left;
  margin: 0;
  padding: 10px;
  background: #ff6a00;
  width: 100px;
  text-align: center;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.