HTML DOM 样式的 columnRuleWidth 属性
htmlweb developmentfront end technology更新于 2024/3/14 1:16:17
HTML DOM 样式的 columnRuleWidth 属性用于设置或获取列规则宽度。
以下是语法 −
设置 columnRuleWidth 属性 −
object.style.columnRuleWidth = "medium|thin|thick|length|initial|inherit"
以上属性值的解释如下 −
| 值 | 描述 |
|---|---|
| thin | 这指定了一条细线。 |
| medium | 这指定了一条中等线,是默认值。 |
| thick | 这指定了一条细线。 |
| length | 用于以长度单位指定规则宽度。 |
| initial | 用于将此属性设置为初始值。 |
| inherit | 用于继承父级属性值 |
让我们看一个 columnRuleWidth 属性的示例 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
#DIV1{
padding: 5px;
column-count: 5;
column-rule-width: 9px;
column-rule-color: lightblue;
column-rule-style: solid;
}
</style>
<script>
function changeColumnRuleWidth(){
document.getElementById("DIV1").style.columnRuleWidth="3px";
document.getElementById("Sample").innerHTML="The column rule width is now reduced";
}
</script>
</head>
<body>
<div id="DIV1">
<img src="https://www.cainiaomax.com/images/Swift.png"><br/>
<img src="https://www.cainiaomax.com/images/xamarian.png"><br/>
<img src="https://www.cainiaomax.com/images/pl-sql.png"><br/>
<img src="https://www.cainiaomax.com/images/asp-net.png"><br/>
<img src="https://www.cainiaomax.com/images/powerbi.png"><br/>
<img src="https://www.cainiaomax.com/images/Tableau.png"><br/>
<img src="https://www.cainiaomax.com/images/Big-Data-Analytics.png"><br/>
<img src="https://www.cainiaomax.com/images/microsoftproject.png">
<img src="https://www.cainiaomax.com/images/QlikView.png"><br/>
<img src="https://www.cainiaomax.com/images/hadoop.png">
</div>
<p>Change the above div column rule width by clicking the below button</p>
<button onclick="changeColumnRuleWidth()">Change Column Rule Width</button>
<p id="Sample"></p>
</body>
</html>
输出

点击"更改列规则宽度"按钮 −

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

