Bootstrap 4 .table-responsive 类不会占用 100% 的宽度

Cas*_*ari 1 html twitter-bootstrap twitter-bootstrap-4 bootstrap-4

我得到了 2 个具有相同 HTML 的表,并且都声明为:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container">
  <div class="row">
    <div class="col-12 col-md-6">
      <div class="card">
        <div class="card-body">
          <table class="table table-sm table-hover table-responsive">
              <thead>
                  <tr>
                      <th>Item 01</th>
                      <th>Item 02</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <td>Item 01</td>
                      <td>Item 02</td>
                  </tr>
              </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这就是我在屏幕上看到的:

检查这张图片

第二和连续的表使用相同的HTML声明没有得到100%的宽度theadtbody...这里有什么不对?

更新:

由于最后一行的内容,我的第一个表正在工作,它足够长以使其 100% 适合我的卡片 div。

实际上 这是 Bootstrap 4 上的一个问题,所以这个问题上的 -2 声誉是无效的。谢谢。

Cas*_*ari 5

发现这是 Bootstrap V4 上的问题,您可以在此问题中看到,我的第一个表格不起作用,只是最后一行的内容足够长以填充表格宽度,所以看起来它有效.

编辑:它得到了通过添加类固定台响应为的父DIV这里是修复船名单,并报告该错误的问题

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container">
  <div class="row">
    <div class="col-12 col-md-6">
      <div class="card">
        <div class="card-body">
          <div class="table-responsive">  
            <table class="table table-sm table-hover">
                <thead>
                    <tr>
                        <th>Item 01</th>
                        <th>Item 02</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Item 01</td>
                        <td>Item 02</td>
                    </tr>
                </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)