Style tableLayout Property
Example
Set a fixed table layout:
document.getElementById("myTable").style.tableLayout = "fixed";
Try it Yourself »
Definition and Usage
The tableLayout property sets or returns the way to lay out table cells, rows, and columns.
Browser Support
The tableLayout property is supported in all major browsers.
Syntax
Return the tableLayout property:
object.style.tableLayout
Set the tableLayout property:
object.style.tableLayout="automatic|fixed|initial|inherit"
Property Values
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 |
Technical Details
Default Value: | auto |
---|---|
Return Value: | A String, representing the table layout algorithm used for a table |
CSS Version | CSS2 |
More Examples
Example
Return the table layout:
alert(document.getElementById("myTable").style.tableLayout);
Try it Yourself »
Related Pages
CSS tutorial: CSS Table
CSS reference: table-layout property
Style Object