当浮动图像超过一定宽度时,如何使用 CSS 将文本向下移动?

发布于 2024-08-26 02:01:10 字数 116 浏览 2 评论 0原文

我有一个文本块,其中有一个图像向左浮动。图像的宽度可以是可变的。如果图像大于块宽度的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

为你鎻心 2024-09-02 02:01:11

我认为你可以将文本放在带有 float:leftdiv 中。 。 。并使 div 的宽度为包含块宽度的 1/3 。这样你就可以确定你不会得到 > 的图像。 2/3 其旁边的块的宽度。

I'd think you could put the text in a div with float:left . . . and make the width of the div be 1/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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文