如何阻止文本环绕一些浮动 div? [英] How can stop text wrapping around some floated divs?

查看:33
本文介绍了如何阻止文本环绕一些浮动 div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在很长一段文本的中间在 div s 中浮动了 3 个图像.我想浮动它们,以便网站保持它的流动"设计,适应任何宽度的浏览器窗口.但是,如果文本开始在宽窗口的左侧换行,则看起来很糟糕.我希望它们浮动,但仍然能够清除它们周围的文本,使它们看起来像一个块元素.我该怎么做?

I floated 3 images in divs in the middle of a long section of text. I want to float them so the site keeps it's 'liquid' design, adapting to any width browser window. But if text starts wrapping to the left of them on wide Windows, it looks bad. I'd like them to float, but still be able to clear text around them so they look like a block element. How can I do that?

我想可能会在图像 div s 之后插入 100% 宽度的 div,即 1px 高,并填充 1px 图像,这只是背景颜色.这会奏效吗?

I thought maybe of sticking in a 100% width div right after the image divs, that's 1px high, and filled with a 1px image that's just the background color. Will that work?

http://www.briligg.com/frailty.html有问题的图像是成瘾的原因是压力"部分开头的图像.第 134 到 146 行,引用内部样式表.

http://www.briligg.com/frailty.html The images in question are the ones at the beginning of the 'the cause of addiction is stress' section. Line 134 to 146, references the internal style sheet.

推荐答案

在图片后面的文本部分添加 clear: left.

Put a clear: left on your section of text following the images.

这似乎是您的 div 与 class text 虽然我不知道您是否希望将 clear 普遍应用于所有具有该类的 div.

That appears to be your div with class text though I don't know if you would want to universally apply the clear to all the divs with that class.

这篇关于如何阻止文本环绕一些浮动 div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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