我已经尝试了两天,但仍然找不到解决方案,请任何人帮助我。
我想你的标题 HTML 是这样的:
使其粘在顶部的 CSS 必须是:
.header { position: fixed; width: 100vw; top: 0px; left: 0px; }
你可以使用粘性
.header {position: sticky;}