HTML DOM 스타일 TableLayout을 속성
정의 및 사용
TableLayout을 속성 세트 또는 표 셀을 반환, 행, 열 표시 알고리즘 규칙.
문법
TableLayout을 속성 설정 :
Object.style.tableLayout="automatic|fixed|inherit"
위로 TableLayout을 속성 :
Object.style.tableLayout
值 | 描述 |
---|---|
auto | 默认。列宽度由单元格内容设定。
|
fixed | 列宽度由表格宽度和列宽度设定(不是由单元格内容设定)。
|
inherit | tableLayout 属性的值从父元素继承。 |
브라우저 지원
모든 주요 브라우저는 TableLayout을 속성을 지원합니다.
참고 : IE7 및 이전 버전은 "상속"값을 지원하지 않습니다.IE8은 "상속"지원!의 DOCTYPE을 제공합니다. IE9 지원 "상속".
예
예
고정 된 테이블 레이아웃을 설정합니다 :
<!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>
<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>
»시도
스타일 개체