快捷导航

怎样进行浮动的清除?

怎样进行浮动的清除?

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员2

Document.container{height:auto;width:400px;margin:100pxauto;border:2pxdottedred;}.item{float:left;width:50px;height:50px;background:yellow;margin-right:10px;}/*.clearfix::after{content:"";height:0;clear:both;display:block;}*/.last{clear:both;}两种方法,一种伪类,一种是在末尾添加空元素,欢迎采纳
回复

使用道具 举报

Document        .fl{float:left;}                .fr{float:right;}        .square{width:200px;height:200px;border:1pxsolid#0000ff;}        .clear{clear:both;}                        square1
                square2                                testtext        大型项目里都会定义一个 .clear 的样式 需要的时候直接用,上边代码你可以把
去掉看看区别

一般情况下, 有浮动必有clear
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP