[英]How do i make a div stay on top of other div's while scrolling the page?
Pls help me. 请帮助我。 I've tried.
我试过了。
This is my code presently 这是我目前的代码
HTML 的HTML
<div id="header"><!--beggining of header-->
</div><!--end of header-->
CSS 的CSS
#header {
width: auto;
height: 100px;
background-color: #F0F;
border-bottom-style: solid;
border-bottom-color: #000;
position: fixed;
}
SORRY. 抱歉。 THIS IS MY FIRST TIME USING THIS STE.
这是我第一次使用此STE。 I CANT POST THE CODE.
我不能发布代码。 BUT SEE THE FULL HTML HERE
但请在此处查看完整的HTML
html: 的HTML:
<div class="cover">
top
<div class="fixed-box">
hello
</div>
</div>
css: CSS:
.fixed-box {
width:100px;/*just for preview*/
height:100px;/*just for preview*/
background:red;/*just for preview*/
position:fixed;
top:10px;
}
.cover {
width:500px;/*just for preview*/
height:10000px;/*just for preview*/
background:blue;/*just for preview*/
}
#header {width: auto; height: 100px; background-color: #F0F; border-bottom-style: solid;
border-bottom-color: #000; position: fixed; top:0px; z-index:100;}
please make sure after the header div make one container div for content and make that div position:relative; z-index:50;
请确保在标头div之后为内容添加一个容器div并将该div
position:relative; z-index:50;
设为position:relative; z-index:50;
position:relative; z-index:50;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.