【问题标题】:Change Width in table using Bootstrap使用 Bootstrap 更改表格中的宽度
【发布时间】:2021-06-14 01:27:13
【问题描述】:

我可以知道如何更改上述 Bootstrap HTML 表格的宽度,因为该表格似乎跨越了浏览器屏幕? 谢谢。

 # here is where i embedded bootstrap into my html table
 <!-- Bootstrap CSS -->
 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

</head>
<body>

<h2>HTML Table</h2>

# i have use bootstrap here for the table design
<div class="table-responsive">
<table class="table, table table-striped">
  <thead class="thead-dark">
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  </thead>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
  </tr>
  <tr>
    <td>Ernst Handel</td>
    <td>Roland Mendel</td>
    <td>Austria</td>
  </tr>
  <tr>
    <td>Island Trading</td>
    <td>Helen Bennett</td>
    <td>UK</td>
  </tr>
</table>
</div>

</body>
</html>

这是一个嵌入了没有 CSS 样式标签的引导程序的 html 代码

【问题讨论】:

标签: html css twitter-bootstrap bootstrap-4


【解决方案1】:
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    border: 1px solid #ddd;
}

【讨论】:

    猜你喜欢
    • 2017-04-06
    • 1970-01-01
    • 2018-01-04
    • 2015-05-14
    • 2017-03-30
    • 1970-01-01
    • 2016-12-14
    • 2013-05-04
    • 2012-01-02
    相关资源
    最近更新 更多