HTML DOM 样式的 columnRule 属性
htmlweb developmentfront end technology更新于 2024/3/13 20:28:17
HTML DOM 的 columnRule 属性用于获取或设置 columnRule 属性。它是操作三个属性(columnRuleColor、columnRuleStyle 和 columnRuleWidth)的简写属性。
以下是语法 −
设置 columnRule 属性 −
object.style.columnRule = "column-rule-width column-rule-style column-rule-color|initial|inherit"
以上属性解释如下 −
| 值 | 描述 |
|---|---|
| columnRuleWidth | 用于设置列间规则宽度。默认设置为"medium"。 |
| columnRuleStyle | 用于设置列间规则样式。默认设置为"none"。 |
| columnRuleColor | 用于设置列间规则样式。默认设置为"none"。 |
| columnRuleColor | 用于设置列间规则颜色。默认设置为元素颜色值。 |
| initial | 用于将此属性设置为初始值。 |
| inherit | 用于继承父级属性值。 |
我们来看一个 columnRule 属性的示例 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
#DIV1 {
column-count: 4;
column-rule: 4px dashed darkolivegreen;
}
</style>
<script>
function changeColumnRule(){
document.getElementById("DIV1").style.columnRule="10px solid red";
document.getElementById("Sample").innerHTML="The column rule properties are now modified";
}
</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">
</div>
<p>Change the above div column rule properties by clicking the below button</p>
<button onclick="changeColumnRule()">Change Column Rule</button>
<p id="Sample"></p>
</body>
</html>
输出

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

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

