DOM中的columnWidth屬性用於指定列的寬度。
用法:
- 返回columnWidth屬性:
object.style.columnWidth
-
設置columnWidth屬性:
object.style.columnWidth = "auto | length | initial | inherit"
屬性值:
- auto:缺省值。列寬將由瀏覽器確定
- length:指定列寬度的長度
- initial:將此屬性設置為其默認值。閱讀有關初始
- inherit:從其父元素繼承此屬性。了解有關繼承的信息
例:
<!DOCTYPE html>
<html>
<body>
<center>
<h1 style="color:green">GeeksforGeeks</h1>
<h2>Style columnWidth Property</h2>
<button onclick="GFGFun()">Click</button>
<div id="DIVid">
HTML stands for Hyper Text Markup Language.
It is used to design web pages using markup language.
HTML is the combination of Hypertext and
Markup language. Hypertext defines the link
between the web pages. Markup language is used
to define the text document within tag which
defines the structure of web pages. HTML is
a markup language which is used by the browser
to manipulate text, images and other content
to display it in required format.
</div>
<script>
function GFGFun() {
//Chrome, Safari, Opera
document.getElementById("DIVid").style.WebkitColumnWidth="50px";
// Firefox
document.getElementById("DIVid").style.MozColumnWidth="50px";
document.getElementById("DIVid").style.columnWidth="50px";
}
</script>
</center>
</body>
</html>
輸出:
之前:
後:
支持的瀏覽器:下麵列出了HTML DOM樣式columnWidth屬性支持的瀏覽器:
- 穀歌瀏覽器
- IE瀏覽器
- Firefox MozColumnWidth
- 蘋果Safari
- Opera
相關用法
- HTML Style right用法及代碼示例
- HTML Style top用法及代碼示例
- HTML Style animationTimingFunction用法及代碼示例
- HTML Style fontStyle用法及代碼示例
- HTML Style textDecorationColor用法及代碼示例
- HTML Style animationFillMode用法及代碼示例
- HTML Style lineHeight用法及代碼示例
- HTML Style visibility用法及代碼示例
- HTML Style paddingRight用法及代碼示例
- HTML Style paddingLeft用法及代碼示例
- HTML Style paddingBottom用法及代碼示例
- HTML Style paddingTop用法及代碼示例
- HTML Style pageBreakBefore用法及代碼示例
- HTML Style width用法及代碼示例
- HTML Style pageBreakInside用法及代碼示例
注:本文由純淨天空篩選整理自Vijay Sirra大神的英文原創作品 HTML | DOM Style columnWidth Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。