目录

style tableLayout 属性

示例

设置固定的表格布局:

document.getElementById("myTable").style.tableLayout = "fixed";
亲自试一试 »

描述

tableLayout 属性设置或返回表格单元格、行和列的布局方式。


浏览器支持

Property
tableLayout Yes Yes Yes Yes Yes

语法

返回 tableLayout 属性:

object.style.tableLayout

设置tableLayout属性:

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

属性值

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


技术细节

默认值: 汽车
返回值: 一个字符串,表示用于表格的表格布局算法
CSS版本 CSS2

更多示例

示例

返回表布局:

alert(document.getElementById("myTable").style.tableLayout);
亲自试一试 »

相关页面

CSS教程:CSS表

CSS 参考:表格布局属性