如何使用Bootstrap固定面板标题?

时间:2016-02-15 20:21:57

标签: html css html5 twitter-bootstrap css3

我有这个Bootstrap结构:

<div class="panel panel-default" style="height:450px;overflow-y:auto">
  <div class="panel-heading">
    <h3 class="panel-title">{% trans "News" %}</h3>
  </div>
  <div class="panel-body" style="padding:0;border:0px;">
  </div>
</div>

当我滚动div panel-heading时,不会按照我想要的那样保持固定。我该如何做到这一点?

1 个答案:

答案 0 :(得分:7)

只需将 overflow-y 参数放在 panel-body 中,而不是整个面板div中:

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">{% trans "News" %}</h3>
  </div>
  <div class="panel-body" style="padding:0;border:0px;height:450px;overflow-y:auto">
  </div>
</div>