gpt4 book ai didi

html - 按钮不断改变他的位置

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

This is the header我的主页。

问题出在“注册”按钮上。当我向下滚动时,按钮会保持其位置,但会随着页面向下滚动。 This image描述问题。

此外,如果我更改网络浏览器的大小,按钮会更改其位置。

我的实际 CSS 代码:

.accp_register {
position: absolute;
width:209px; height:43px;
z-index:99;
top:0; right:80px;
left:896px;
position:fixed;
}
.accp_register #register_button {
background-image:url(../images/register.jpg);
/*background-repeat: no-repeat;*/
background-position:0 0;
display:block;
width:209px; height:43px;
position:fixed;
margin-left:0px;
}
.accp_register #register_button h1 { display:none; position:fixed;}
.accp_register #register_button:hover {background-position:0 -43px; position:fixed;}

.accp_register #accp_button {
background-image:url(../images/userpanel.jpg);
background-repeat:0;
background-position:0 0;
display:block;
width:209px; height:43px;
position:fixed;
}
.accp_register #accp_button h1 { display:none; position:fixed;}
.accp_register #accp_button:hover {background-position:0 -43px; position:fixed;}

.fixed{

position: fixed;
}

最佳答案

这是因为您在按钮的 CSS 中使用了 position:fixed。即使在滚动时位置固定也会将其保留在屏幕上。

引用:http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/

关于html - 按钮不断改变他的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22588606/

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