HTML DOM Style captionSide 屬性

2018-08-04 20:41 更新

Style captionSide 屬性

Style 對象參考手冊 Style 對象

定義和用法

captionSide 屬性設(shè)置或返回表格標題的位置。

語法

設(shè)置 captionSide 屬性:

Object.style.captionSide="top|bottom|inherit"

返回 captionSide 屬性:

Object.style.captionSide

描述
top 默認。把表格標題定位在表格之上。
bottom 把表格標題定位在表格之下。
inherit captionSide 屬性的值從父元素繼承。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 captionSide 屬性。

注意:IE7 及更早的版本不支持 captionSide 屬性。IE8 只有規(guī)定了 !DOCTYPE 才支持 captionSide 屬性。IE9 支持 captionSide 屬性。


實例

實例

把表格標題移到表格底部:

<html>
<head>
<script>
function displayResult()
{
document.getElementById("myTable").style.captionSide="bottom";
}
</script>
</head>
<body>

<table id="myTable" border="1">
<caption>My savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$150</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Move table caption</button>

</body>
</html>

嘗試一下 ?


Style 對象參考手冊 Style 對象
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號