#logo {
position: fixed;
top: 85%;
left: 40%;
height: 104px;
width: 90px;
border: solid 3px black;
border-left: 0px;
opacity: 1;
transform: scale(.9) translate(-50%, -50%);
padding: 2px;
transition: all 1s ease;
box-sizing: border-box;
}
#logo::before {
z-index: 100;
content: "Brand";
line-height: 91px;
font-size: .9rem;
text-align: center;
color: white;
position: fixed;
height: 91px;
width: 91px;
left: -8px;
top: 4px;
background: black;
}
/*for demo only*/body {height:400px;}
<div id="logo"></div>
div#logo 没有固定在滚动条上……为什么?? 我已经在移动设备上编写了这段代码,还没有在桌面上尝试过。所以我不确定这是否是仅限移动设备的问题。我可能在这里做了一些愚蠢的事情
最佳答案
我也检查过它,它工作正常。 您能否发布整个 css 和 html,以便我们更好地查看它?干杯
关于html - 位置固定不起作用?我究竟做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53600397/