<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
标签 html css html-table
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
我这样声明一个表:
<div class="row">
<div class="module span12">
<section class="module">
<table class="table table-striped table-bordered table-condensed">
echo "<tr><td style='color: white; background-color: black;'><strong>Overall inventory breakdown</strong></td>";
echo "<td style='text-align: center; color: white; background-color: black;'><strong></strong></td>";
echo "<td style='text-align: center; color: white; background-color: black;'><strong>Ist</strong></td>";
echo "<td style='text-align: center; color: white; background-color: black;'><strong>Soll</strong></td></tr>";
</table>
</section>
</div>
</div>
现在,表格和整个页面一样宽。但我希望它更小。
我已经尝试过几种 CSS 变体,例如在每个 td
上设置 width
值,但对我来说没有任何效果。有帮助吗?
最佳答案
这似乎是一个 Bootstrap 问题。
.table {
/* width: 100%; */
width: auto;
}
了解浏览器的文档检查工具。它使发现此类事物的来源变得微不足道。
关于html - 如何更改 HTML 表格的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37864149/