css别忘记清除浮动clear:both_经验交流
来源:懂视网
责编:小采
时间:2020-11-27 18:55:18
css别忘记清除浮动clear:both_经验交流
css别忘记清除浮动clear:both_经验交流:用空标签清除 .clr {clear: both;} Left Right 使用 overflow 属性 #layout {overflow:auto; zoom:1;} Left Right 使用 :after (非 IE 浏览器) #layout:after{ display: block; clear: both; c
导读css别忘记清除浮动clear:both_经验交流:用空标签清除 .clr {clear: both;} Left Right 使用 overflow 属性 #layout {overflow:auto; zoom:1;} Left Right 使用 :after (非 IE 浏览器) #layout:after{ display: block; clear: both; c

用空标签清除
.clr {clear: both;}
Left
Right
使用 overflow 属性
#layout {overflow:auto; zoom:1;}
Left
Right
使用 :after (非 IE 浏览器)
#layout:after{
display: block;
clear: both; content: "";
visibility:hidden; height: 0;
}
Left
Right
注:使用 :after 需要注意几点,设置高度为零(height: 0;);content 是必须的,但其值可以为空
css别忘记清除浮动clear:both_经验交流
css别忘记清除浮动clear:both_经验交流:用空标签清除 .clr {clear: both;} Left Right 使用 overflow 属性 #layout {overflow:auto; zoom:1;} Left Right 使用 :after (非 IE 浏览器) #layout:after{ display: block; clear: both; c