Column span屬性
定義和使用
span 屬性用於設置或者返回列的span屬性值。
span 屬性定了<col> 元素橫跨的列數。
瀏覽器支持
所有主流瀏覽器都支持span 屬性。
語法
返回span 屬性:
columnObject .span
設置formMethod 屬性:
columnObject .span= number
屬性值
值 | 描述 |
---|---|
number | 描述了<col> 元素横跨的列数 |
技術描述
返回值: | 一個數字,代表著列數 |
---|
更多實例
實例
使用span 和backgroundColor 屬性設置前兩列的背景色為紅色:
document.getElementById("myCol").span="2";
document.getElementById("myCol").style.backgroundColor="red";
document.getElementById("myCol").style.backgroundColor="red";
嘗試一下»
相關頁面
HTML參考手冊: HTML <col> span屬性