gpt4 book ai didi

html - CSS:清除 float 周围的文本,但不是其他 float

转载 作者:行者123 更新时间:2023-11-28 02:17:29 25 4
gpt4 key购买 nike

我正在开发一个 Web 元素,我想清除 div 左右两侧的文本,但让其他 div 能够沿着它 float 。我认为 float 属性是执行此操作的最佳方式,但 CSS 的“clear”属性仅影响其他 float ,而不影响文本。

结果看起来像这样(希望你们都喜欢 ASCII 艺术!)

________________________________________________
| This is a long line of text that is going |
| to wrap around multiple lines. It wiil be |
| ________________ ________________ |
| | First Div | | Secondary Div | |
| | declared in | |_______________| |
| | previous line| |
| |______________| |
| interrupted by the divs that are declared in |
| the line itself. |
|______________________________________________|

div 可以在行中的任何位置开始。在这种情况下,假设第一个 div 在单词“wrap”处声明,第二个 div 在“It”之后声明。

有人知道这个的解决方案吗?

最佳答案

你需要 javascript (jQuery) 来做类似的事情。

不仅 div 被从流中移除,而且还必须测量空间,如果有空间,额外的 div 会被移入。它可能会变得复杂、快速。

关于html - CSS:清除 float 周围的文本,但不是其他 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3082170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com