
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to set the column rule properties with JavaScript?
The columnRule property is used in JavaScript to set the column rule. It allows you to set the style, color, and width between column rule.
Example
You can try to run the following code to set the column rule properties with JavaScript −
<!DOCTYPE html> <html> <body> <p>Click below to create 4 columns</p> <button onclick="display()">Columns</button> <div id="myID"> This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. </div> <script> function display() { document.getElementById("myID").style.columnCount = "4"; document.getElementById("myID").style.columnRule = "2px outset red"; } </script> </body> </html>
- Related Articles
- How to set the four transition properties with JavaScript?
- How to set the color of the rule between columns with JavaScript?
- How to set the style of the rule between columns with JavaScript?
- How to set the width of the rule between columns with JavaScript?
- Shorthand property for setting all the column-rule-* properties
- How to set column width and column count with JavaScript?
- How to set all the outline properties in one declaration with JavaScript?
- How to set all the background properties in one declaration with JavaScript DOM?
- How to set all the border left properties in one declaration with JavaScript?
- How to set all the four border radius properties at once with JavaScript?
- How to set all the border right properties in one declaration with JavaScript?
- How to set all the border top properties in one declaration with JavaScript?
- How to set all outline properties in a single declaration with JavaScript?
- Set the color of the rule between columns with CSS
- Set the style of the rule between columns with CSS

Advertisements