您的位置:首页 > Web前端 > CSS

CSS清除浮动的三个方法

2015-06-15 13:27 603 查看

clear: both;

浮动末尾添加新标签,设置样式为clear:both

浮动末尾添加
标签

使用::after伪元素

构造BFC

构造BFC的方法

float设置为非none值

overflow设置为非visible

display设置为table-cell,table-caption,inline-block

position设置为absolute或fixed

IE6/7下没有BFC的概念,但有类似BFC的 has layout

has layout的方法

有些元素本身就 has layout

没有 has layout 的元素

position:absolute

float不为none

display:inline-block

height:除auto外任意值

width:除auto外任意值

zoom:除normal外任意值

overflow非visible(仅限IE7)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: