Twitter bootstrap 带引导列的引导粘贴xx yy类

Twitter bootstrap 带引导列的引导粘贴xx yy类,twitter-bootstrap,affix,Twitter Bootstrap,Affix,我正在尝试使用引导粘贴将向下滚动时的navigatorhorizontal固定到顶部。导航器会在向下滚动时粘贴到顶部,但可滚动内容会在其上方而不是下方滚动 更多背景资料。。。主体即可滚动内容是一种表单,它具有引导面板和输入字段,这些字段使用col md-*类来格式化布局。这个类的使用似乎是在添加position:relative属性,这似乎是导致重叠的原因 我的问题…我是CSS新手,所以 我不明白为什么位置:相对内容与位置:fixednavigator重叠。 我不明白为什么bootstrap添加

我正在尝试使用引导粘贴将向下滚动时的navigatorhorizontal固定到顶部。导航器会在向下滚动时粘贴到顶部,但可滚动内容会在其上方而不是下方滚动

更多背景资料。。。主体即可滚动内容是一种表单,它具有引导面板和输入字段,这些字段使用col md-*类来格式化布局。这个类的使用似乎是在添加position:relative属性,这似乎是导致重叠的原因

我的问题…我是CSS新手,所以

我不明白为什么位置:相对内容与位置:fixednavigator重叠。 我不明白为什么bootstrap添加了位置:相对于这些组件,没有附加的top、left、bottom或right属性。如果没有这些属性之一,这与默认的position:static不一样吗? 最后,我该如何解决这个问题。我正在寻找一个标准的非黑客解决方案,它不会在引导升级时中断。 编辑:在起草这篇文章的时候,我有了一个想法,给导航器添加了一个正的z索引,可滚动的内容现在在导航器后面滚动。这是正确的解决方案吗?不过,我仍在寻找其他问题的答案。多谢各位

*编辑2:在这里找到我所有问题的答案。 还有一个问题我在这里没有提到…如果偏移量为零,单击和滚动都会粘贴和修复。将偏移设置为1

现在我需要弄清楚如何将此标记为已解决*

这是我用W3C创建的小提琴示例

谢谢你的帮助

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
  /* Note: Try to remove the following lines to see the effect of CSS positioning */
  .affix {
      top: 0;
      width: 100%;
  }

  .affix + .container-fluid {
      padding-top: 70px;
  }
  </style>
</head>
<body>

<div class="container-fluid" style="background-color:#F44336;color:#fff;height:200px;">
  <h1>Bootstrap Affix Example</h1>
  <h3>Fixed (sticky) navbar on scroll</h3>
  <p>Scroll this page to see how the navbar behaves with data-spy="affix".</p>
  <p>The navbar is attached to the top of the page after you have scrolled a specified amount of pixels.</p>
</div>

<nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="197">
  <ul class="nav navbar-nav">
    <li class="active"><a href="#">Basic Topnav</a></li>
    <li><a href="#">Page 1</a></li>
    <li><a href="#">Page 2</a></li>
    <li><a href="#">Page 3</a></li>
  </ul>
</nav>

<div class="container-fluid" style="height:1000px">
  <div class="col-md-6">
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
  </div>
  <div class="col-md-6">
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
    <h1>Some text to enable scrolling</h1>
  </div>
</div>
</body>
</html>

找到了解决问题的方法

在这里找到了我所有问题的答案。很棒的博客!
还有一个问题我在这里没有提到…如果偏移量为零,单击和滚动都会粘贴和修复。将偏移量设置为1。

是的,man z-index是正确的方法。@grusl83-谢谢。总有一天我会把CSS的东西弄下来的。