/

HTML / CSS / JavaScript Tutorial

CSS Property: column-rule

[this page | pdf | back links]

The CSS (CSS1) column-rule property is a shorthand property combining (up to) 3 of the column-rule properties.

 

Valid property values (other than inherit and initial) are defined by the elements of the shorthand. Shorthand elements (in the order in which they appear):

 

-        column-rule-width

-        column-rule-style

-        column-rule-color

 

Default Value:

See individual properties

JavaScript syntax:

e.g. object.style.columnRule="3px outset red"

Inherited:

No

Animatable:

See individual properties

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {width: 200px; column-count: 2;}
p.x1 {column-rule: 10px double red;}
</style>
</head>
<body>
1. Element with default property<br>
<p>Some text that may be broken into several columns</p><br><br>
2. Element set using in-file HTML style
<p class="x1">Some text that may be broken into several columns</p><br><br>
3. Element set using JavaScript
<p id="x2">Some text that may be broken into several columns</p>

<script>
document.getElementById("x2").style.columnRule="10px double red";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyColumnRule() {
  var x = document.createElement("DIV"); x.style.columnRule = "10px double red"; return (window.getComputedStyle(x, null).columnRule == "10px double red");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile