如何只清除一个浮动对象?
关于浮动和清算的问题。 这是小提琴。 如何让文本出现在红色对象下方? 如果我使用 clear: left
,文本将出现在黑色对象下方,因为它的高度比红色对象高。 仅使用 float 和clear 是否有可能获得我正在寻找的外观?
A question about floats and clearing. Here's the fiddle.
How do I get the text to appear under the red object?
If I use clear: left
, the text appears under the black object because it has greater height than the red one.
Is it possible to get that look I'm looking for by using only float and clear?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将
red
div 后跟h2
标签放入左侧浮动的包含 div 中(您可以从red
中删除 float:left div,您可以从h2
中删除clear:left
:)http://jsfiddle.net/XqLFX/
You need to put
red
div followed by theh2
tag in a containing div that floats left (you can remove the float:left from thered
div. and you can remove theclear:left
fromh2
:)http://jsfiddle.net/XqLFX/
我认为你的设计是错误的。这是新的 jsfiddle
使新的 div 向左浮动
I think you are wrong on wrong design. This is the new jsfiddle
Make the new div float left