Set a fixed table layout:
document.getElementById("myTable").style.tableLayout = "fixed";
Try it Yourself »
The tableLayout property sets or returns the way to lay out table cells, rows, and columns.
Property | |||||
---|---|---|---|---|---|
tableLayout | Yes | Yes | Yes | Yes | Yes |
Return the tableLayout property:
object.style.tableLayout
Set the tableLayout property:
object.style.tableLayout = "auto|fixed|initial|inherit"
Value | Description |
---|---|
auto | Column width is set by the widest unbreakable content. This is default.
|
fixed | Column width is set by the width of table and columns (not the content of the cells)
|
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | auto |
---|---|
Return Value: | A String, representing the table layout algorithm used for a table |
CSS Version | CSS2 |
Return the table layout:
alert(document.getElementById("myTable").style.tableLayout);
Try it Yourself »
CSS tutorial: CSS Table
CSS reference: table-layout property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!