【发布时间】:2026-01-25 22:35:01
【问题描述】:
在 w3.css 中,w3-responsive 使表格在小屏幕中可滚动,但表格在中或大屏幕中不再是全宽。 我正在寻找一种解决方案,让表格既能在小屏幕上响应,又能在大屏幕上全宽。
下面的图片在中等屏幕中显示了我的表格。如您所见,它是右对齐的,大约三分之一的屏幕是空的。
注意:全宽边框属于表格而非父元素。所以表格是全宽的,但它的内容不是。
生成的表格图片:
表格代码:
<table id="result" class="w3-table-all w3-hoverable w3-centered w3-card w3-responsive">
<tr>
<th>index</th>
<th>date</th>
<th>product</th>
<th>variable</th>
<th>status</th>
<th>count</th>
<th>stock</th>
<th>user</th>
</tr>
<tr id="37172" class="table-data">
<td>1</td>
<td>2021/09/04</td>
<td>something</td>
<td>yellow</td>
<td>In</td>
<td>5</td>
<td>0</td>
<td>test</td>
</tr>
【问题讨论】:
标签: css w3.css full-width