我正在尝试使用类选择器为某个表设置固定宽度。
但它根本不受影响。这种语法有什么遗漏/错误?
CSS
.delivoptions_table th {
table-layout:fixed;
overflow: hidden;
width: 200px;
}
table ..
<div class = "delivoptions_table">
<table id="deliver_alt_table">
<tr>
<td> ... </td>
</tr>
...
</table>
</div>
最佳答案
您的 CSS 选择器针对所有 <th>
.delivoptions_table
中的元素<div>
,但您没有任何 <th>
里面的元素。更新您的选择器以定位 <table>
本身:
.delivoptions_table table {
table-layout:fixed;
overflow: hidden;
width: 200px;
}
关于css - 设置表格宽度 - 不受影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37540357/