如何从HTML底部删除溢出滚动条边框

时间:2019-01-18 11:09:35

标签: html css

我有一个带有溢出滚动(.table响应)的引导表。它的工作正常,但我想从底部删除滚动条。我如何删除它?

<!DOCTYPE html>
<html lang="en">
<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/4.1.3/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <div class="table-responsive">
  <table class="table table-bordered" style="width:1500px;">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>Doe</td>
        <td>john@example.com</td>
      </tr>
      <tr>
        <td>Mary</td>
        <td>Moe</td>
        <td>mary@example.com</td>
      </tr>
      <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
      </tr>
    </tbody>
  </table>
</div>
</div>

<script>

</script>

</body>
</html>

1 个答案:

答案 0 :(得分:3)

是因为表比容器宽。您要么以1500px的格式删除内联样式,要么将overflow-x: hidden;赋予容器以禁用水平滚动,但是表的宽度将相同,并且其中很大一部分将不可见< / p>

如果要保持水平滚动,但要隐藏滚动条,则应尝试以下操作:

div::-webkit-scrollbar{
  display: none;
}

注意:它仅在基于Webkit的浏览器中有效