HTML滚动条仅显示部分框边框

时间:2019-06-12 18:33:46

标签: html css scrollbar

我正在尝试将滚动条集成到HTML模板的以下div中,并且希望即使在为空时也始终显示“框”。但是,当我执行overflow: scroll时,仅会出现部分框框边框(在右侧和底部,而不是在顶部和左侧)。我该如何解决?

<div class="col-sm-6">
  <h1>Results</h1>
  <br><br>
  <div style="width: 500px; overflow: scroll; height: 400px;">
  <br>
  <p class="my-results"></p>
  </div>
</div>

enter image description here

1 个答案:

答案 0 :(得分:0)

您还需要添加一个border样式属性。 overflow: scroll与上边框和左边框无关。

<div style="width: 500px; overflow: scroll; height: 400px; border: solid 1px #ccc">
   ...
</div>
相关问题