停止标题/导航栏滚动

时间:2015-07-08 09:18:08

标签: css

好的,所以我有标题/导航栏,每页都向上/向下滚动。我如何简单地将其修复到页面顶部,以便它不再滚动,内容滚动到它后面?我检查了很多例子,但大多数都很老,似乎没有用。 我想要整个标题包括。导航栏只是为了保持固定位置!

感谢任何帮助。 谢谢Damien

<header> 
    <div class="nav-responsive"><div>MENU</div>
        <select onchange="location=this.value">
            <option></option>
            <option value="index.html">Home</option>
            <option value="about.html">About</option>
            <option value="services.html">Services</option>
            <option value="products.html">Products</option>
            <option value="contacts.html">Contacts</option>
        </select>
    </div>
   <div> 
      <div>                     
          <h1><a href="index.html"><img src="images/JungleDesign.png" alt=""></a></h1> 
          <nav>  
            <ul class="menu">
                  <li class="current"><a href="index.html">Home</a></li>
                  <li><a href="about.html">About</a></li>
                  <li><a href="services.html">Services</a></li>
                  <li><a href="products.html">Products</a></li>
                  <li><a href="contacts.html">Contacts</a></li>
              </ul>
          </nav>
          <div class="clear"></div>
      </div>
  </div>
</header>  

3 个答案:

答案 0 :(得分:3)

使用固定位置

header{
  position: fixed;
  top: 0;
  width: 100%;
}

在关注标题元素之后,您可以使用padding-top: {{header-height}}

管理您的顶部空格

答案 1 :(得分:0)

[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true hideDotFiles = dotGitOnly [gui] wmstate = normal geometry = 1187x555+90+96 239 251 [branch "lk"] [branch "master"] [remote "origin"] url = git@github.com:IvanSelivanov/stroysauna_pg.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master 中添加一个固定的类,然后在CSS中添加:

<header class="fixed-header">

答案 2 :(得分:0)

谢谢你们,但我自己解决了,这是因为Slider的Z级别高于标题。一切都很好!!

相关问题