Style tableLayout attribute
- Previous Page scrollBehavior
- Next Page tabSize
- Go Up One Level HTML DOM Style Object
Definition and Usage
tableLayout
Property to set or return the layout style of table cells, rows, and columns.
See also:
CSS Tutorial:CSS Table
CSS Reference Manual:table-layout attribute
Instance
Example 1
Set fixed table layout:
document.getElementById("myTable").style.tableLayout = "fixed";
Example 2
Return table layout:
alert(document.getElementById("myTable").style.tableLayout);
Syntax
Return tableLayout attribute:
object.style.tableLayout
Set tableLayout attribute:
object.style.tableLayout = "auto|fixed|initial|inherit"
Attribute value
Value | Description |
---|---|
auto |
Column width is set by the widest non-breakable content. Default. This layout is sometimes slow because it needs to access all content before the table is fully displayed. |
fixed |
Column width is determined by the table and column width settings (not the content of the cells) fixed is faster than automatic layout because once the first row is received, the user agent can start displaying the table. |
initial | Set this attribute to its default value. See also initial. |
inherit | This attribute inherits from its parent element. See also inherit. |
Technical details
Default value: | auto |
---|---|
Return value: | A string indicating the table layout algorithm used for the table. |
CSS Version: | CSS2 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page scrollBehavior
- Next Page tabSize
- Go Up One Level HTML DOM Style Object