固定位置在Firefox中不工作 [英] Fixed positioning not working in Firefox

查看:107
本文介绍了固定位置在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.

这篇关于固定位置在Firefox中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆