【问题标题】:table in html bootstrap not fitting in to screenhtml bootstrap 中的表格不适合屏幕
【发布时间】:2021-04-01 21:51:50
【问题描述】:

我在 html bootstrap 中有一个表格,该表格在页面加载时看起来很合适,但在页面完全加载后表格变得可滚动

我的代码是:

<div class="table-responsive">
  <table class="table table-striped table-borderd" id="orderTable">
    <thead>
      <tr>
        <th>S.No</th>
        <th>Order ID</th>
        <th>Ordered By</th>
        <th>Branch name</th>
        <th>Order Date </th>
        <th>Order Time </th>
        <th>Status</th>
        <th>Invoice Status</th>
        <th>Actions</th>
      </tr>
    </thead>
    <tfoot>
      <tr class="sn">
        <th>S.No</th>
        <th>Order ID</th>
        <th>Ordered By</th>
        <th>Branch name</th>
        <th>Order Date </th>
        <th>Order Time </th>
        <th>Status</th>
        <th>Invoice Status</th>
        <th>Actions</th>
      </tr>

    </tfoot>
    <tbody>
    </tbody>
  </table>
</div>

谁能告诉我如何使它适合屏幕并避免滚动。提前致谢

【问题讨论】:

  • 你能显示你的整个代码吗?只有这些代码可以正常工作,并且表格在我的机器上无法滚动。
  • @Zubair:和平!您有一些其他 CSS 应用于该表。在 codepen 上分享你的代码。将需要检查问题。我在没有滚动的情况下检查了它。
  • @George 数据来自数据库
  • @ImranRafiqRather 你能开个聊天室吗
  • 等一下兄弟:)让我打开并分享链接

标签: html css bootstrap-4 html-table


【解决方案1】:

事实证明,这种情况下的主要问题是 &lt;input/&gt; 元素的宽度,这使得我们所有的列都遵循相同的宽度。

我已经使用Desktop Screen 的以下 CSS 解决了这个问题。对于较小的屏幕,最好有滚动条,以免丢失任何数据。

@media (min-width:1320px{  
    tfoot th input {
        width: 90px !important;
    }
}

稍后您可以根据需要调整此设置以实现更大的屏幕断点。

【讨论】:

  • @Zubair:如果我的回答对您有帮助,您想抽出几秒钟的时间投票并接受我的回答。这将帮助其他开发人员从中受益。谢谢你:)
猜你喜欢
  • 2020-12-07
  • 2013-04-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-09
  • 2019-05-28
相关资源
最近更新 更多