我在网页中使用了
当滚动时,该
因此,我想到了一种基本的结构,即先编写特定
有没有办法在滚动时将
fixed
position
来将一个div
固定在页面顶部作为页眉,但是在滚动时,它会被其他对象遮挡,如divs
、视频甚至文本!以下是一个示例图:
![div as it should look at all times](https://istack.dev59.com/VnvaB.webp)
div
会隐藏:
![div hides when it is scrolled down](https://istack.dev59.com/LoF3N.webp)
div
的代码(我已经这样做了),然后再编写其他对象的代码,其他对象就会自然地出现在前面。所以,一种解决方法是将其代码编写在最后。但是,我的结构化代码中有适当放置的注释,这可能会破坏它。<div style="width: 1409.25px; height:40px; top:0; left:0; position:fixed; background-color:black; line-height:2;">..Text here..</div>
有没有办法在滚动时将
提到前面,而不必在结尾处编写其代码?