-1

请帮助我。我试过了。

这是我目前的代码

HTML

    <div id="header"><!--beggining of header-->

    </div><!--end of header-->

CSS

    #header {
    width: auto;
    height: 100px;
    background-color: #F0F;
    border-bottom-style: solid;
    border-bottom-color: #000;
    position: fixed;
    }

对不起。这是我第一次使用这个 STE。我不能发布代码。但请在此处查看完整的 HTML

4

2 回答 2

5

检查这个小提琴

html:

<div class="cover">
  top
   <div class="fixed-box">
     hello                            
   </div>
</div>

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*/
}
于 2012-12-05T10:26:03.380 回答
0
#header {width: auto; height: 100px; background-color: #F0F; border-bottom-style: solid;
    border-bottom-color: #000; position: fixed; top:0px; z-index:100;}

请确保在标题 div 之后为内容制作一个容器 div 并制作该 divposition:relative; z-index:50;

于 2012-12-05T10:28:25.440 回答