Style tableLayout Property

Example

Set a fixed table layout:

document.getElementById("myTable").style.tableLayout = "fixed";
Try it Yourself »

Description

The tableLayout property sets or returns the way to lay out table cells, rows, and columns.


Browser Support

Property
tableLayout Yes Yes Yes Yes Yes

Syntax

Return the tableLayout property:

object.style.tableLayout

Set the tableLayout property:

object.style.tableLayout = "auto|fixed|initial|inherit"

Property Values

Value Description
auto Column width is set by the widest unbreakable content. This is default.
  • This layout is sometimes slow since it needs to access all the content before the table can be fully displayed
fixed Column width is set by the width of table and columns (not the content of the cells)
  • Fixed is faster than auto layout, because the user agent can begin to display the table once the first row has been received
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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.