br clear =“all” vs css解决方案 [英] br clear="all" vs css solution

查看:244
本文介绍了br clear =“all” vs css解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div是float:left,然后div是页面的其余部分。
为了使页面的其余部分保持在div下面,我必须先放置

I have a div that is float:left, and after the div is the rest of the page. In order to keep the rest of the page below the div, I must first place a

<br clear="all">

问:如何将页面的其余部分放置在浮动div下方?
我认为我需要将页面的其余部分包装在一个新的div,并将其浮动。

Q: How do I position the rest of the page below the floated div? I think that I need to wrap the rest of the page in a new div and float it as well. But I tend to stay away from floats as much as I can.

推荐答案

在下一个项目上,你可以使用

On the next item you can use the style clear:left.

另一种方法是设置 overflow style在浮动元素的父级上,使其包含它,如 overflow:hidden

Another alternative is to set the overflow style on the parent of the floating element to make it contain it, like overflow:hidden.

这篇关于br clear =“all” vs css解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆