gpt4 book ai didi

html - 我可以只溢出一个 div 吗?

转载 作者:太空宇宙 更新时间:2023-11-03 17:52:05 27 4
gpt4 key购买 nike

我想知道我是否只能隐藏我的 2 个 div 之一而不是另一个 http://codepen.io/LeaFrontend/pen/yyNbeb

<div class="container">
<div class="box1"></div>
<div class="box2"></div>
</div>

.container {
position: relative;
border: 1px solid red;
width: 300px;
height: 100px;
overflow:hidden;
}


.box1 {
position: absolute;
width: 40px;
height: 40px;
border: 1px solid green;
top: 90px;
}

.box2 {
position: absolute;
width: 40px;
height: 40px;
border: 1px solid blue;
left: 290px;
}

我需要保持相同的结构不确定这是否可能

最佳答案

这是你要做的:

A. 取消 CSS 代码的 .container block 中的溢出属性。

B.然后使用top、bottom、left和right属性的值使其溢出到你想要的方向。

C. 对您希望重叠的区域使用负值。如果想让box1向右重叠100px,设置right属性值-100px。

right: -100px;

关于html - 我可以只溢出一个 div 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27133561/

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