gpt4 book ai didi

html - 固定位置 div 溢出包含 div

转载 作者:太空宇宙 更新时间:2023-11-03 20:42:19 26 4
gpt4 key购买 nike

如何让 div .inner 覆盖整个屏幕? jsfiddle

HTML:

<div class="outer">
<div id="inner">This should cover the entire screen</div>
</div>

CSS:

.outer {
margin: auto; width: 100%;
top: 0; bottom: 0;
height: 100vh;
max-width: 20rem;
background: blue;
}

.inner {
top: 0; bottom: 0; left: 0; right: 0;
position: fixed;
background: gray;
z-index: 2
}

最佳答案

在你的css中,它应该是#inner

#inner {
top: 0;
bottom: 0;
left: 0;
right: 0;
position: fixed;
background: gray;
z-index: 2;
}

关于html - 固定位置 div 溢出包含 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24672122/

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