【发布时间】:2021-07-29 15:25:43
【问题描述】:
我对 CSS 中的粘性位置有一个奇怪的问题。 我希望一个元素贴在页面底部,如果视口高度大于或等于 500px,它可以正常工作,但如果进一步减小,则元素不再贴在页面底部
这就是粘性元素的样子
.sticky{
position: sticky;
bottom: 0;
top: 90%;
display: flex;
height: 50px;
width: 100%;
justify-content: center;
align-items: center;
background: var(--tl-dark-theme);
}
这是粘性元素的容器
section {
height: 100%;
}
【问题讨论】: