這裏是我的表結構表格的佈局:固定的CSS沒有給定列的寬度正常工作
<table id="recordingsTable" style="width:900px" class="tablesorter fixed_table">
</table>
CSS:
.fixed_table{
table-layout: fixed;
}
填充表從JS:
str = ''
str += '<thead>'
str += '<tr>' +
'<th style="width:150px;text-align:left !important;border-left:0;">Col 1</th>' +
'<th style="width:150px;text-align:center !important">Col 2</th>' +
'<th style="width:300px;text-align: center !important;">Col 3</th>' +
'<th style="width:100px;text-align: center !important;">Col 4</th>' +
'<th style="width:100px;text-align: center !important;">Col 5</th>' +
'<th style="width:100px;text-align: center !important;">Col 6</th>' +
'</tr>' +
'</thead><tbody style="border-bottom: 1px solid #dddddd;">';
for(i=0; i < recording_object.length; i++) {
str += '<tr>';
str += '<td style="text-align:left !important; padding-left:8px;border-left:0;">'
str += recording_object[i].text
str += '</td>'
str += '<td class="s3_file_path">' + recording_object[i].path + '</td>'
str += '<td class="s3_file_name" style="font-size:11px;">' + recording_object[i].file_name + '</td>'
str += '<td>' + recording_object[i].number + '</td>'
str += '<td>';
str += '<button id="' + recording_object[i].id + '" onclick="dup_dialog(this)" type="button" data-toggle="modal" ' +
'data-target="#upload-all-modal" disabled="disabled" class="btn btn-primary btn-xs">Duplicate</button>' +
'</td>'
str += "<td>";
str += '<button id="' + recording_object[i].id + '" class="btn btn-primary btn-xs" data-toggle="modal" ' +
'disabled="disabled" data-target="#association">Association</button>'
str += '</td></tr>'
}
str += '</tbody>'
但它沒有顯示js中定義的表格列的寬度,當我更改任何列寬度時它不會在視圖中更改;即使當我通過檢查元素
來改變它時,它似乎表格佈局不能正常工作,因爲它應該給定每個列寬度。誰能幫忙?
你能張貼呈現的HTML請 – Pete
加入截圖 –