Bootstrap 3:修复div行

时间:2016-06-24 14:37:10

标签: css3 twitter-bootstrap-3

我有两个div:

<div class="row">
</div>


<div class="row">
</div>

我需要在滚动时修复第一个。我这样做了:

<div style="position:fixed" class="row">
</div>

现在div正在重叠:https://jsfiddle.net/DTcHh/22068/

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

HTML:

<div class="row fixed"></div>
<div class="row padding"></div>

CSS:

.fixed {
  position: fixed;
  background: #fff;
  z-index: 10;
  width: 100%;
}
.padding {
  padding-top: 54px // height of your fixed row, you have to change this value on different screen sizes (using media queries)
}

JSFIDDLE