CSS float and clear

25 年 8 月 24 日 星期日
115 字
1 分钟

Clear

clear: left:

  • 它只要求 元素的顶部必须在所有左浮动元素的下方

  • 对右浮动元素没要求。

clear: both:

  • clear: both 的作用是:元素的顶部必须在之前所有浮动元素的下方

  • 它并不是“强制换行”的意思,而是“避免与浮动元素重叠”。

When applied to non-floating blocks, it moves the border edge of the element down until it is below the margin edge of all relevant floats. The non-floated block's top margin collapses.

文章标题:CSS float and clear

文章作者:Sirui Chen

文章链接:https://blog.siruichen.me/posts/css_float_and_clear[复制]

最后修改时间:


商业转载请联系站长获得授权,非商业转载请注明本文出处及文章链接,您可以自由地在任何媒体以任何形式复制和分发作品,也可以修改和创作,但是分发衍生作品时必须采用相同的许可协议。
本文采用CC BY-NC-SA 4.0进行许可。