当浮动图像超过一定宽度时,如何使用 CSS 将文本向下移动?
我有一个文本块,其中有一个图像向左浮动。图像的宽度可以是可变的。如果图像大于块宽度的 2/3,我希望文本落在图像下方,但如果不是,我希望文本位于图像旁边。
如果重要的话,所有这些都在 Drupal 中。
I have a text block with an image floated left. The images can be of variable width. If the image is say greater than 2/3 the width of the block I want the text to drop down below the image but if not I want it beside the image.
All of this is in Drupal if that matters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你可以将文本放在带有
float:left
的div
中。 。 。并使div
的宽度为包含块宽度的1/3
。这样你就可以确定你不会得到> 的图像。 2/3 其旁边的块的宽度。
I'd think you could put the text in a
div
withfloat:left
. . . and make the width of thediv
be1/3
the width of the containing block. That way you could be sure you wouldn't have an image of> 2/3
the width of the block next to it.