HTML DOM 样式的 columnRuleColor 属性

htmlweb developmentfront end technology更新于 2024/3/13 21:32:17

HTML DOM 样式的 columnRuleColor 属性用于设置或返回列之间的规则颜色。

以下是语法 −

设置 columnRuleColor 属性 −

object.style.columnRuleColor = "color|initial|inherit"

此处,color 指定规则的颜色。Initial 将值设置为默认值,而 Inherit 将其设置为父属性值。

让我们看一个关于 columnRuleColor 属性的示例 −

示例

<!DOCTYPE html>
<html>
<head>
<style>
   #DIV1{
      padding: 5px;
      column-count: 5;
      column-rule-width: 9px;
      column-rule-style: solid;
      column-rule-color: lightcoral;
   }
</style>
<script>
   function changeColumnRuleColor(){
      document.getElementById("DIV1").style.columnRuleColor="blue";
      document.getElementById("Sample").innerHTML="The column rule color is now changed";
   }
</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 color by clicking the below button</p>
   <button onclick="changeColumnRuleColor()">Change Column Rule Color</button>
   <p id="Sample"></p>
</body>
</html>

输出

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


相关文章


有用资源