问题描述
在我的Bootstrap 3项目中,我需要一个带有固定列宽的表格。每个< th>
在我的表< table id =itemsclass =table table-striped table-condensed> code>有
style = ## px
,但它未分配它。我尝试添加 style =width:auto; overflow:scroll;
到表,但它不工作。
I need a table with fixed column widths in px on my Bootstrap 3 project. Every <th>
in my table <table id="items" class="table table-striped table-condensed">
has style=##px
but its not assigning it. I've tried adding style="width:auto; overflow: scroll;"
to the table but it does't work. Also tried removig every class on my table but colums wont grow.
请帮助!
推荐答案
解决方案最终是从< table>
中删除'table'这样,您可以通过css或直接在其width属性上指定< th>
的de width。对于表类,即使像建议的答案一样指定< colgroup>
,列宽不能设置。
The solution finally was to remove 'table' class from the <table>
. That way you can specify de width on <th>
by css or directly on its width attribute. With the table class the width of the column can't be set even specifying a <colgroup>
like a suggested answer.
这篇关于Bootstrap 3表,用px和滚动条设置固定列宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!