Style tableLayout attribute

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";

Try it yourself

Example 2

Return table layout:

alert(document.getElementById("myTable").style.tableLayout);

Try it yourself

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