简体   繁体   English

表格宽度不能设置为385像素以下,并且无法响应

[英]Table width can't be set below 385 pixels and responsiveness issue

I am using Bootstrap and have a part in my code that is: 我正在使用Bootstrap,并且在我的代码中包含以下部分:

<table class="table">...</table>

In my header, I have the tag <meta name="viewport" content="width=device-width"> This actually works fine(I can see the whole table on my website) but when I add <meta name="viewport" content="width=device-width initial-scale=1"> like is suggested on many websites, my table doesn't fit the 320 px width viewport that I have been using to test and I have to scroll to see the whole table. 在标头中,我有标签<meta name="viewport" content="width=device-width">确实可以正常工作(我可以在网站上看到整个表格),但是当我添加<meta name="viewport" content="width=device-width initial-scale=1">就像许多网站上建议的那样,我的表格不适合我用来测试的320像素宽度的视口,因此必须滚动才能查看整个视图表。

Further investigation and playing around with the css for .table shows that I can't manually set width below 385 px. 进一步调查并研究.table的CSS结果表明,我无法手动将宽度设置为385 px以下。 I have tried searching "bootstrap table 385 px" but it doesn't seem like there is anything special about this number so I am wondering why the table can't be smaller. 我曾尝试搜索“ bootstrap table 385 px”,但这个数字似乎没有什么特别之处,所以我想知道为什么表格不能更小。 Does anyone have any ideas as to how I can make the table smaller or make it scale correctly to initial-scale=1? 有人对我如何缩小表或使其正确缩放到initial-scale = 1有任何想法吗?

Edit #1: 编辑#1:

<table class="table">
  <thead>
    <tr>
      <th>Col1</th>
      <th>Col2</th>
      <th>Col3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <input type="checkbox" ng-model="..."> ...
      </td>
      <td>
        <input type="checkbox" ng-model="..."> ...
      </td>
      <td width=70%>
        <input class="form-control" ng-model="...">
      </td>
      <td>
        <button class="btn btn-primary" ng-click="...">...</button>
      </td>
    </tr>
    <tr ng-repeat="... in ...">
      <td class="claimedby-{{...}}">
        <input type="checkbox" ng-model="..." ng-click="...">&nbsp;{{...}}
      </td>
      <td>
        <input type="checkbox" ng-model="..." ng-click="..."> ...
      </td>
      <td>
        <div for="...">
          <div class="...">{{...}}</div>
        </div>
      </td>
      <td>
        <button class="btn btn-danger" ng-click="...">...</button>
      </td>
    </tr>
  </tbody>
</table>

Sorry for the "..." in certain places. 抱歉在某些地方出现“ ...”。 I'm not sure if we're allowed to post exact code publicly. 我不确定是否可以公开发布确切的代码。 Hopefully this is enough to see what's going wrong though. 希望这足以查看出了什么问题。

Here, this should do it for you 在这里,这应该为你做

    <table class="table">
  <thead>
    <tr>
      <th class="col-md-4 col-xs-2">Col1</th>
      <th class="col-md-4 col-xs-2">Col2</th>
      <th class="col-md-4 col-xs-8">Col3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <input type="checkbox" ng-model="..."> ...
      </td>
      <td>
        <input type="checkbox" ng-model="..."> ...
      </td>
      <td>
        <input class="form-control" ng-model="...">
      </td>
      <td>
        <button class="btn btn-primary" ng-click="...">...</button>
      </td>
    </tr>
    <tr ng-repeat="... in ...">
      <td class="claimedby-{{...}}">
        <input type="checkbox" ng-model="..." ng-click="...">&nbsp;{{...}}
      </td>
      <td>
        <input type="checkbox" ng-model="..." ng-click="..."> ...
      </td>
      <td>
        <div for="...">
          <div class="...">{{...}}</div>
        </div>
      </td>
      <td>
        <button class="btn btn-danger" ng-click="...">...</button>
      </td>
    </tr>
  </tbody>
</table>

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

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