

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the gap between the columns with JavaScript?
To set the gap between columns, use the columnGap property.
Example
You can try to run the following code to learn how to set the gap between columns with JavaScript −
<!DOCTYPE html> <html> <body> <p>Click below to create 4 columns and set gap of 30px</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.columnGap = "30px"; } </script> </body> </html>
- Related Questions & Answers
- Specify the gap between the columns with CSS
- Set the size of the gap between CSS grid columns
- 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?
- How to return or set the width of the columns with JavaScript?
- How to set horizontal gap between elements in a GridLayout with Java?
- How to set vertical gap between elements in a GridLayout with Java?
- Set the color of the rule between columns with CSS
- Set the style of the rule between columns with CSS
- Set the width of the rule between columns with CSS
- How to set the space between characters in a text with JavaScript?
- How to set the distance between lines in a text with JavaScript?
- How to set the space between cells in a table with JavaScript?
- How to specify the size of the gap between rows in CSS Grid
Advertisements