Div在滚动期间停留。 CSS

时间:2017-01-23 06:45:38

标签: css angularjs scroll

我想做div" Scroll"留在一个地方,即使在滚动期间。这是我的代码:



.Scroll {
  position: fixed;
}
.Down {
  clear: both;
}

<div class="container-fluid">
  <div class="Scroll">
    <div class="Down">
      <div class="form-group">
        <input type="text" class="form-control input-lg" placeholder="Search">
      </div>
      <div class="form-group" style="display:inline-block;width:300px;">
        <h4><small>Select Date From <span class="glyphicon glyphicon-calendar"></span></small></h4>
        <input type="date" class="form-control" style="width:250px;" class="form-control" />
        <h4><small>Select Date To <span class="glyphicon glyphicon-calendar"></span></small> </h4>
        <input type="date" class="form-control" style="width:250px;" class="form-control" />
      </div>
    </div>
  </div>
</div>
<div class="Down">
  <table>
    <thead>
      <tr>
        <th>NAME</th>
        <th>DATE</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="name in names">
        <td>{{name.name}}</td>
        <td>{{name.date}}</td>
      </tr>
    </tbody>
  </table>
</div>
&#13;
&#13;
&#13;

它不起作用。提前感谢您的回答!

2 个答案:

答案 0 :(得分:1)

只需添加position:absolute代替position:fixed,如下所示:

.Scroll {
  /*position: fixed;*/
    position: absolute;
}

答案 1 :(得分:0)

您需要有足够的内容进行滚动,否则您将无法滚动。 以下css是我使用的:

.Scroll {
display:block;
  position: fixed;
  top:100;
  left:100;
  background:#fff;
}
.Down {
  clear: both;
}

见我的jsfiddle:

https://jsfiddle.net/e63eyswp/1/