【问题标题】:problems using position fixed使用固定位置的问题
【发布时间】:2012-05-23 22:16:08
【问题描述】:

问题在于,只要 topBar 具有 position:fixed (因此当页面加载时,标题几乎隐藏在 topBar 下方),标题的上边距就会被忽略。

如何解决 margin-top 被忽略的问题?

提前谢谢..

【问题讨论】:

  • 试试margin-top:top-bar的高度;否则给一些代码

标签: css


【解决方案1】:

据我从您的问题中了解到,您试图将 position:fixed 仅提供给 topBar。请找到我的伪代码来回答您的问题。尝试将位置固定添加到外部标题容器,以便顶部栏和标题都保持固定。

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

【讨论】:

    【解决方案2】:

    如果问题仍然存在,请使用此代码,然后共享代码

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

    【讨论】:

      【解决方案3】:

      将页眉的上边距设置为所需的值加上 topBar 的高度。

      【讨论】:

        猜你喜欢
        • 2012-10-04
        • 2011-01-05
        • 1970-01-01
        • 2013-08-18
        • 2015-03-05
        • 1970-01-01
        • 2013-07-29
        • 2012-03-21
        • 1970-01-01
        相关资源
        最近更新 更多