Style tableLayout attribute

Definition and usage

tableLayout Sets or returns the layout method of table cells, rows, and columns.

See also:

CSS Tutorial:Tabela de CSS

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-breaking 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 Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: auto
Return value: String, representing the table layout algorithm used for tables.
Versão do CSS: CSS2

Suporte ao navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporte Suporte Suporte Suporte Suporte