请查看此 JSFiddle:
<IMG src="https://www.google.com.hk/images/srpr/logo11w.png" alt="This image will illustrate floats">
<span>The contents of floats are </span>
图像被浮动,而具有clear:both。但是,如果的显示值为
inline
或inline-block
,则不会创建间隔。仅当它是block
时,才会创建间隔。我查看了规范,它说:
“both:要求框的顶部边缘在源文档中早期元素导致的任何右浮动和左浮动框的底部外边缘之下。”
它没有提到
display
如何影响清除的创建。有人能帮忙解释一下吗?