gpt4 book ai didi

html - iframe 作为 div 背景,内部有可见内容且可点击

转载 作者:行者123 更新时间:2023-11-28 19:20:59 27 4
gpt4 key购买 nike

我必须将 Vimeo 设置为包含 CTA 框的 div 的背景。我找到了一些示例,并使视频背景全屏显示并根据需要进行响应成为可能。但我发现里面的 CTA 框和按钮不可点击,因为用于将视频返回到 div 中的“z-index”。

玩z-index来回移动元素

.vimeo-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display:flex;
pointer-events: none;
overflow: hidden;

}
.vimeo-wrapper iframe {
width: 100vw;
height: 56.25vw; /* Given a 16:9 aspect ratio, 9/16*100 = 56.25 */
min-height: 100vh;
min-width: 177.77vh; /* Given a 16:9 aspect ratio, 16/9*100 = 177.77 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);

}.content{
display:flex;
align-items:center;
justify-content:center;
z-index:1;
flex-wrap:wrap;
}.content,h2{
width:100%;
text-align:center;
color:white;
}
.CTA-wrapper{
border:2px solid white;
width:30%;
padding-bottom:2%;

}
div button:hover {
color: yellow;
}
<div class="vimeo-wrapper">
<iframe src="https://player.vimeo.com/video/342964528? background=1&autoplay=1&loop=1&byline=0&title=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<div class="content">
<div class="CTA-wrapper">
<h2>CTA Header</h2>
<button class="btn-success">Click Me</button>
</div>
</div>
</div>

预期:可点击的内部元素、全屏和响应式背景视频结果:不是可点击的内部元素

最佳答案

.CTA-wrapper{
position: relative;
z-index: 9999;
}

关于html - iframe 作为 div 背景,内部有可见内容且可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57302801/

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