Latest web development tutorials
 

Style tableLayout Property

< Style Object

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

Internet Explorer Firefox Opera Google Chrome Safari

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.
  • 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


< Style Object