本文介绍了CSS:清除内联元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检查此 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具有显示值inlineinline-block,则不会创建间隙.仅当它是block时,才会创建间隙.

The image is floated, and the span has clear:both. However, if the span has display value inline or inline-block, the clearance is not created. Only if it is block, the clearance is created.

我检查了规范 ,它说:

它没有提到display如何影响间隙的创建.有人可以帮忙解释一下吗?

It doesn't mention how the display affects the creation of the clearance. Could anybody help to explain?

推荐答案

很简单: clear 仅适用于块级元素.

It's simple: clear only applies to block-level elements.

适用于:块级元素

块级元素定义为

这篇关于CSS:清除内联元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 02:17