我知道这样的问题已经被问过几千次了,但是这个问题让我抓狂。我正在尝试创建一个简单的弹出窗口,父窗口的高度是设置好的,如果我设置标题栏的高度,它什么也不会改变。
希望有人能帮我这个忙,这样我今天就不用摔键盘了。
谢谢你。
html {
height: 100vh;
}
#popup-window {
position: absolute;
;
height: 50%;
width: 50%;
background-color: #50ed77;
border: 1px solid #3E3B3B;
border-radius: 5px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 800px;
z-index: 2;
-webkit-box-shadow: 2px 2px #000;
box-shadow: 2px 2px #000;
}
#popup-window-titlebar {
background-color: #21522d;
color: white;
padding: 10px;
font-weight: bold;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
#popup-window-inner {
margin: 5px;
max-height: 100%;
height: 100%;
}
#popup-window-list {
margin: 5px;
padding: 10px;
height: 100%;
max-width: 100%;
max-height: 100%;
overflow-y: auto;
}
.window-close-btn {
float: right;
color: #fff;
font-weight: bold;
transition-duration: .5s;
}
.window-close-btn:hover {
cursor: pointer;
color: #ff115c;
}
<div id="popup-window">
<div id="popup-window-titlebar">
<b>Funny Title</b>
<div class="window-close-btn">
X
</div>
</div>
<div id="popup-window-inner">
<div id="popup-window-list">
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
</div>
</div>
</div>
想修复溢出。现在在谷歌上搜索了2个小时,尝试了不同的属性(位置,高度...)
3条答案
按热度按时间xlpyo6sf1#
我会让你的弹出窗口的方向列伸缩,然后你可以使内部伸缩增长(采取后的标题弹出剩余的高度)。
如果你把内部变量设为相对变量,你可以完全定位你的滚动div来填充内部变量,然后你的溢出就可以工作了:
xzlaal3s2#
添加溢出并更改#popup-window的高度
更新样式
dluptydi3#