我正在尝试修复列的宽度(名称:链接),但无法在下面执行此操作是我的代码
<table class="table table-striped table-bordered">
<thead>
<th>ID</th>
<th>User</th>
**<th class="col-sm-2">Link</th>**
<th>Charge</th>
<th>Start count</th>
<th>Quantity</th>
<th>Type</th>
<th>Status</th>
<th>Date</th>
但桌子的输出没有变化,请你告诉我我在做什么wronge?
答案 0 :(得分:1)
您的html没有关闭thead
或table
,但是当您正确格式化html时,列类确实有效。许多人使用表格中的类。
.col-sm-2
从最小宽度:768px开始,它是父(表)宽度的16.6666666666667%。从最小宽度开始,它将保持16.6666666666667%,然后将恢复为默认宽度。
<table class="table table-striped table-bordered">
<thead>
<th>ID</th>
<th>User</th>
<th class="col-sm-2">Link</th>
<th>Charge</th>
<th>Start count</th>
<th>Quantity</th>
<th>Type</th>
<th>Status</th>
<th>Date</th>
</thead>
</table>
答案 1 :(得分:0)
从class="col-sm-2"
中移除th
,即网格,而不是表格。
要修复列的大小,请为其指定一个已定义的宽度,例如<th style="width: 150px;"></th>
或为其指定一个类名并在其中设置属性,例如:
<th class="small"></th>
th.small {
width: 150px;
}