浮动元素移出父元素

时间:2018-09-26 19:56:03

标签: html css css-float

当我浮动span元素时,为什么它要离开父元素div但没有浮动却停留在div内?谢谢

div {
  border: 1px solid red;
  width: 500px;
}
<div>
  <p>This paragraph has an inherited left margin (from the div 
  element).</p>
  <span style="float:left">Test data</span>
</div>

0 个答案:

没有答案