problems using position fixed

The problem is though that header's top margin is ignored as long as topBar has position:fixed (So when the page loads, header is pretty much hidden below topBar).

How do I fix margin-top being ignored?

Thanks in advace..


As far as I understand from your question you are trying to give position:fixed only to topBar. Please find my pseudo code to answer your problem.Try adding position fixed to the outer header container so that both the top bar and header stays fixed.

 <header style="position:fixed;">
   <nav class="top-bar">
   </nav>
 </header>

如果问题仍然存在,则使用此分享代码

#header
{
position:fixed;
top:0px;
width:100%;
height:30px;
}

将标题的顶部边距设置为所需值加上topBar的高度。

链接地址: http://www.djcxy.com/p/62050.html

上一篇: 固定菜单覆盖锚点

下一篇: 使用位置固定的问题