CSS:仅当内部 div 获得焦点时页面才可滚动
CSS: Page is scrollable only if the inner div is focused
我在里面有一个衬垫和一个注册 div。内部 div 内容是基于注册的动态内容 step.If 内容在高度上扩展,变得可滚动。问题是滚动只有在鼠标位于focused/hovered on inner-div 时才有效。我希望它能够滚动,即使我的鼠标在内部 div 之外(悬停在底层上)。那可能吗?以及如何?
.underlay {
position: fixed;
top: 0;
left: 0;
z-index: 2;
width: 100%;
height: 100%;
background: #eaeaea;
}
.inner-div{
position: relative;
z-index: 3;
}
问题出在 html 代码中:
<div class="registration">
... content
</div>
<div class="underlay"></div>
解决方案是一个简单的嵌入:
<div class="underlay">
<div class="registration">
... content
</div>
</div>
我在里面有一个衬垫和一个注册 div。内部 div 内容是基于注册的动态内容 step.If 内容在高度上扩展,变得可滚动。问题是滚动只有在鼠标位于focused/hovered on inner-div 时才有效。我希望它能够滚动,即使我的鼠标在内部 div 之外(悬停在底层上)。那可能吗?以及如何?
.underlay {
position: fixed;
top: 0;
left: 0;
z-index: 2;
width: 100%;
height: 100%;
background: #eaeaea;
}
.inner-div{
position: relative;
z-index: 3;
}
问题出在 html 代码中:
<div class="registration">
... content
</div>
<div class="underlay"></div>
解决方案是一个简单的嵌入:
<div class="underlay">
<div class="registration">
... content
</div>
</div>