gpt4 book ai didi

html - Css 强制子 div 从具有绝对位置和 overflow hidden 的父级中退出

转载 作者:行者123 更新时间:2023-11-28 04:43:40 25 4
gpt4 key购买 nike

我有一个展开的 DIV 动画:http://codepen.io/gabrielmalinosqui/pen/OyLogq

我现在想做的是在 div 中添加一个列表,其中包含一类“内容”设置为隐藏。

即使父级有 position:absoluteoverflow:hidden

也有什么方法可以强制子 div 离开父级吗?

如果我将我的列表换成无样式的,它会起作用,选择不会被剪裁,但这可能是某种浏览器样式?

html:

<div class='wrap'>
<div class='content'>
<h2>Well Hello!</h2>
<p>contents...</p>
</div>
</div>
<a class='button glyphicon glyphicon-plus' href='#'></a>

CSS:

.wrap {
position: absolute;
overflow: hidden;
top: 10%;
right: 10%;
bottom: 85px;
left: 10%;
padding: 20px 50px;
display: block;
border-radius: 4px;
transform: translateY(20px);
transition: all 0.5s;
visibility: hidden;
}
.wrap .content {
opacity: 0;
}
.wrap:before {
position: absolute;
width: 1px;
height: 1px;
background: white;
content: "";
bottom: 10px;
left: 50%;
top: 95%;
color: #fff;
border-radius: 50%;
-webkit-transition: all 600ms cubic-bezier(0.215, 0.61, 0.355, 1);
transition: all 600ms cubic-bezier(0.215, 0.61, 0.355, 1);
}
.wrap.active {
display: block;
visibility: visible;
box-shadow: 2px 3px 16px silver;
transition: all 600ms;
transform: translateY(0px);
transition: all 0.5s;
}
.wrap.active:before {
height: 2000px;
width: 2000px;
border-radius: 50%;
top: 50%;
left: 50%;
margin-left: -1000px;
margin-top: -1000px;
display: block;
-webkit-transition: all 600ms cubic-bezier(0.215, 0.61, 0.355, 1);
transition: all 600ms cubic-bezier(0.215, 0.61, 0.355, 1);
}
.wrap.active .content {
position: relative;
z-index: 1;
opacity: 1;
transition: all 600ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
}

最佳答案

overflow-y: scroll 添加到您的 .wrap { }

.wrap {
position: absolute;
overflow: hidden;
overflow-y: scroll; //Add this
top: 10%;
right: 10%;
bottom: 85px;
left: 10%;
padding: 20px 50px;
display: block;
border-radius: 4px;
transform: translateY(20px);
transition: all 0.5s;
visibility: hidden;

关于html - Css 强制子 div 从具有绝对位置和 overflow hidden 的父级中退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41077621/

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