gpt4 book ai didi

html - 如何防止显示:flex item from clearing the previous float?

转载 作者:太空宇宙 更新时间:2023-11-04 05:36:28 26 4
gpt4 key购买 nike

看起来 display:flex item 会自动清除之前的 float 。

如何防止清除? (我需要之前的内容与 flex 容器重叠)。

例如:

.floater{
float:right;
width: 200px;
border:1px solid red;
}
.row{
display:flex;
border:1px solid green;
padding:12px;
width:100%;
clear:none;
}
.col-400{
flex-basis:400px;
border:1px solid blue;
padding:12px;
}
.col-grow{
flex-grow:1;
border:1px solid teal;
padding:12px;
}
<div class='outer'>
Intro content
<div class='floater'>
Please float to right. And don't clear.
Please float to right. And don't clear.
Please float to right. And don't clear.
</div>
<div class='row'>
<div class='col-400'>
Left col
Left col
Left col
Left col
Left col
</div>
<div class='col-grow'>
Main col
Main col
Main col
Main col
Main col
Main col
Main col
Main col
Main col
Main col
</div>
</div>
</div>

看起来像这样: enter image description here

我想让红色重叠在绿色上。

最佳答案

使用position: absolute;

.floater{
position: absolute;
float:right;
width: 200px;
border:1px solid red;
}

关于html - 如何防止显示:flex item from clearing the previous float?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59600369/

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