CSS: 清除内联元素
CSS: clear on inline elements
检查这个 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>
图像浮动,span
有clear:both
。但是,如果 span
的显示值为 inline
或 inline-block
,则不会创建间隙。只有block
,才会创建间隙
我检查了 Spec,它说:
both: Requires that the top border edge of the box be below the bottom
outer edge of any right-floating and left-floating boxes that resulted
from elements earlier in the source document.
它没有提到 display
如何影响许可的创建。有人可以帮忙解释一下吗?
检查这个 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>
图像浮动,span
有clear:both
。但是,如果 span
的显示值为 inline
或 inline-block
,则不会创建间隙。只有block
,才会创建间隙
我检查了 Spec,它说:
both: Requires that the top border edge of the box be below the bottom outer edge of any right-floating and left-floating boxes that resulted from elements earlier in the source document.
它没有提到 display
如何影响许可的创建。有人可以帮忙解释一下吗?