简体   繁体   English

移动视图中的Bootstrap v4.0.0-alpha.3表重排问题

[英]Bootstrap v4.0.0-alpha.3 table-reflow issue in mobile view

I was trying the below code in mobile view not able to fix the table-reflow issue in mobile view. 我正在移动视图中尝试以下代码,但无法解决移动视图中的表重排问题。 Any suggestion will be really appericiated 任何建议都会很贴切

See image here 在这里查看图片

View code at CODEPEN CODEPEN上查看代码

<div class="container">
  <div class="row">
    <div class="col-sm-12">
      <table class="table table-reflow">
        <thead>
          <tr>
            <th>Id</th>
            <th>Employee Name</th>
            <th>Salary</th>
            <th>Bonus</th>
            <th>Total</th>
          </tr>
        </thead>
        <tbody>
          <tr scope="row">
            <td>665</td>
            <td>Amit Shah</td>
            <td>10000</td>
            <td>1000</td>
            <td>11000</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>

This seems to be a known issue in BS4 alpha: https://github.com/twbs/bootstrap/issues/20510 这似乎是BS4 alpha中的一个已知问题: https : //github.com/twbs/bootstrap/issues/20510

One workaround is to set a fixed width to the table to prevent it from wrapping. 一种解决方法是为表格设置固定宽度,以防止表格包装。

http://www.codeply.com/go/WX8ByNRqMy http://www.codeply.com/go/WX8ByNRqMy

I have the solution for you using media query. 我为您提供使用媒体查询的解决方案。 Hope it might help you. 希望对您有所帮助。 check the CODEPLY link 检查CODEPLY链接

CSS: CSS:

@media (max-width: 544px) {
  .table-reflow thead,
  .table-reflow thead tr,
  .table-reflow tbody tr {
    width: 100%;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM