固定位置在Firefox中不工作
我有以下的HTML在我的网页,我想保持固定在左侧side.It侧边栏在Chrome工作正常,但Firfox不显示侧边栏固定:
I have following HTML in my webpage where I want to keep the sidebar fixed on the left side.It works fine in the Chrome but Firfox isn't displaying the sidebar as fixed :
<div id="sidebar">
<!-- Logo -->
<div >
<h1>Heading</h1>
</div>
<!-- Nav -->
<nav id="nav">
<ul>
<li><a href="#target1" >About</a></li>
<li><a href="#target2" >Works</a></li>
<li><a href="#target3" >Our Team</a></li>
<li><a href="#target4" >Contact</a></li>
</ul>
</nav>
</div>
上述代码的CSS为:
the CSS for above code is :
#sidebar
{
position: fixed;
top: 0;
padding: 3em 1.35em 1em 1.15em;
height: 100%;
width: 12em;
background: #364050 ;
box-shadow: inset -0.1em 0em 0.35em 0em rgba(0,0,0,0.15);
}
请给我建议一些解决方案,使侧边栏在Firefox中保持固定。 br>
please suggest me some solution so that the sidebar will remain fixed in Firefox.
DOWNVOTERS请先评论。
检查您的身体CSS标签,元和任何可能影响到该div。也许有另一个css规则覆盖'position'
另外,如果你有css3标签或错误在主体css中,例如 transform:translate3d(0px,0px,0px);
可以使固定位置在Firefox中断。
Check your body css tags, the metas, and anything that could affect to that div. Maybe there is another css rule overwriting that 'position'
Also, if you have css3 tags or errors in the body css, for example, transform: translate3d(0px, 0px, 0px);
that could make fixed position break in Firefox.