gpt4 book ai didi

javascript - 为什么没有覆盖整个屏幕宽度?

转载 作者:太空宇宙 更新时间:2023-11-04 08:36:50 25 4
gpt4 key购买 nike

我使用 css 和 JavaScript 来锁定屏幕,但我不确定为什么锁定面板与屏幕的宽度不同,您知道吗?这是 HTML 源代码,您找到如下 javascript 代码,有人帮助我吗?

JavaScript:

function FreezeScreen(msg) {
scroll(0,0);
var outerPane = document.getElementById('FreezePane');
var innerPane = document.getElementById('InnerFreezePane');
if (outerPane) outerPane.className = 'FreezePaneOn';
if (innerPane) innerPane.innerHTML = msg;
}

HTML:

<body>
<div align="center" id="FreezePane" class="FreezePaneOff">
<div id="InnerFreezePane" class="InnerFreezePane"> </div>
</div>

CSS:

.FreezePaneOff {
visibility: hidden;
display: none;
position: absolute;
top: -100px;
left: -100px;
}

.FreezePaneOn {
position: absolute;
top: 0px;
left: 0px;
visibility: visible;
display: block;
width: 100%;
height: 100%;
background-color: #666;
z-index: 999;
filter:alpha(opacity=85);
-moz-opacity:0.85;
padding-top: 20%;
}

.InnerFreezePane {
text-align: center;
width: 66%;
background-color: #171;
color: White;
font-size: large;
border: dashed 2px #111;
padding: 9px;
}

最佳答案

如果你想让它覆盖屏幕,你可以将 position:absolute 更改为 position:fixed

Position property :

absolute - The element is positioned relative to its first positioned (not static) ancestor element.

fixed - The element is positioned relative to the browser window.

关于javascript - 为什么没有覆盖整个屏幕宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44402426/

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