[英]change table column width
I'm using react library that constructs table in the following template: 我正在使用在以下模板中构造表的React库:
<div class="table-container" style="width:100%">
<table style="width:100%">
<thead>
<tr>
<th>BLA_Column</th>
</tr>
</thead>
</table>
<table style="width:100%">
<tbody>
<tr>
<td>BLA_Body</td>
</tr>
</tbody>
</table>
</div>
I'm able to set the width of the th and the td to auto, but, the result is that I get two different sizes (one for the th and one for the td). 我可以将th和td的宽度设置为auto,但是结果是我得到两种不同的尺寸(一种用于th,一种用于td)。 When I try to use the following selector (for example), nothing happens: 当我尝试使用以下选择器(例如)时,什么都没有发生:
table > thead > th {
width: 100px;
}
Also when I try to change directly the width using the chrome dev-tools, there is no change at all. 另外,当我尝试使用chrome dev-tools直接更改宽度时,根本没有任何更改。
Thanks ahead! 谢谢你!
CSS character > select only direct childs. CSS字符>仅选择直接子代。 Change your CSS with : 使用以下命令更改CSS:
table > thead th {
width: 100px;
}
or 要么
table > thead > tr > th {
width: 100px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.