Latest web development tutorials

HTML DOM propiedad Estilo TableLayout

Estilo de referencia de objetos Objetos de estilo

Definición y Uso

TableLayout conjuntos de propiedades o devuelve una celda de tabla, fila, columna reglas del algoritmo de visualización.

gramática

Configuración de las propiedades TableLayout:

Object.style.tableLayout="automatic|fixed|inherit"

Volver propiedades TableLayout:

Object.style.tableLayout

描述
auto 默认。列宽度由单元格内容设定。
  • 这种布局有时是缓慢的,因为它需要在表格完全显示之前访问所有内容。
fixed 列宽度由表格宽度和列宽度设定(不是由单元格内容设定)。
  • fixed 布局的速度比 auto 布局快,因为用户代理在接收到第一行后就可以显示表格。
inherit tableLayout 属性的值从父元素继承。


Soporte para el navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los principales navegadores soportan la propiedad TableLayout.

Nota: Internet Explorer 7 y versiones anteriores no son compatibles con el valor "heredar".IE8 sólo proporciona! DOCTYPE apoyado "hereda". apoyo IE9 "hereda".


Ejemplos

Ejemplos

Fijar un modelo de mesa fija:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    document.getElementById("myTable").style.tableLayout="fixed";
}
</script>
</head>
<body>

<table id="myTable" width="300" border="1">
    <thead>
        <th>表格表头</th>
        <th>表格表头</th>
    </thead>
    <tbody>
    <tr>
            <td>这是一些文本。这是一些文本。</td>
            <td>这是另一些文本</td>
    </tr>
    </tbody>
</table>
<br>
<button type="button" onclick="displayResult()">设置固定的表格布局</button>

</body>
</html>

Trate »


Estilo de referencia de objetos Objetos de estilo