The DOM Style columnGap property specifies the gap between the columns.
Syntax :
- For return the value:
object.style.columnGap
- For set the value:
object.style.columnGap = "length|normal|initial|inherit"
Property Values:
- length: Set the column gap in length unit.
- normal: The default value of column gap.
- initial: Sets the default value.
- inherit: Inherit property from parent element.
Return Value : This will return a String representing the column-gap property of an element.
- Length: This specifies a length that will set the gap between the columns.
Example-1:
<!DOCTYPE html><html><head><title>HTML | DOM Style columnGap Property</title><style>#myDIV {width: 600px;height: 70%;border: 2px solid green;padding: 10px;column-count: 3;}#p1 {font-size: 20px;color: green;}</style></head><body><divid="myDIV"><pid="p1"><u>Welcome to GeeksforGeeks.!</u>An operating system acts as an intermediarybetween the user of a computer and computerhardware. The purpose of an operating systemis to provide an environment in which a usercan execute programs in a convenient andefficient manner. An operating system issoftware that manages the computer hardware.The hardware must provide appropriate mechanismsto ensure the correct operation of the computersystem and to prevent user programs frominterfering with the proper operation of the system.</p></div><br><inputtype="button"onclick="mainFunction()"value="Submit"/><script>function mainFunction() {// Set columnGap in length.document.getElementById("myDIV").style.columnGap = "100px";}</script></body></html>chevron_rightfilter_noneOutput:
- Before Click:
- After Click:


- normal: This specifies a normal gap between the columns.
Example-2:<!DOCTYPE html><html><head><title>HTML | DOM Style columnGap Property</title><style>#myDIV {width: 600px;height: 70%;border: 2px solid green;padding: 10px;column-count: 3;column-gap: 100px;}#p1 {font-size: 20px;color: green;}</style></head><body><divid="myDIV"><pid="p1"><u>Welcome to GeeksforGeeks.!</u>An operating system acts as an intermediarybetween the user of a computer and computerhardware. The purpose of an operating systemis to provide an environment in which a usercan execute programs in a convenient andefficient manner. An operating system issoftware that manages the computer hardware.The hardware must provide appropriate mechanismsto ensure the correct operation of the computersystem and to prevent user programs frominterfering with the proper operation of the system.</p></div><br><inputtype="button"onclick="mainFunction()"value="Submit"/><script>function mainFunction() {// Set columnGap to normal.document.getElementById("myDIV").style.columnGap = "normal";}</script></body></html>chevron_rightfilter_noneOutput:
- Before Click:
- After Click:


- initial: This sets this property to its default value.
Example-3:
<!DOCTYPE html><html><head><title>HTML | DOM Style columnGap Property</title><style>#myDIV {width: 600px;height: 70%;border: 2px solid green;padding: 10px;column-count: 3;column-gap: 100px;}#p1 {font-size: 20px;color: green;}</style></head><body><divid="myDIV"><pid="p1"><u>Welcome to GeeksforGeeks.!</u>An operating system acts as an intermediarybetween the user of a computer and computerhardware. The purpose of an operating systemis to provide an environment in which a usercan execute programs in a convenient andefficient manner. An operating system issoftware that manages the computer hardware.The hardware must provide appropriate mechanismsto ensure the correct operation of the computersystem and to prevent user programs frominterfering with the proper operation of thesystem.</p></div><br><inputtype="button"onclick="mainFunction()"value="Submit"/><script>function mainFunction() {// set columnGap into normal.document.getElementById("myDIV").style.columnGap = "initial";}</script></body></html>chevron_rightfilter_noneOutput:
- Before Click:
- After Click:


- inherit: This inherits this property from its parent element.
Example-4:<!DOCTYPE html><html><head><title>HTML | DOM Style columnGap Property</title><style>#myDIV {width: 600px;height: 60%;border: 2px solid green;padding: 10px;column-count: 3;column-gap: 100px;}#p1 {column-gap: 50px;}</style></head><body><divid="myDIV"><pid="p1"><ustyle="color: green ;font-size: 20px;">Welcome to GeeksforGeeks.!</u><br>An operating system acts as an intermediarybetween the user of a computer and computerhardware. The purpose of an operating systemis to provide an environment in which a usercan execute programs in a convenient andefficient manner. An operating system issoftware that manages the computer hardware.The hardware must provide appropriate mechanismsto ensure the correct operation of the computersystem and to prevent user programs frominterfering with the proper operation of thesystem.</p></div><br><inputtype="button"onclick="mainFunction()"value="Submit"/><script>function mainFunction() {// Set columnGap "inherit".document.getElementById("myDIV").style.columnGap = "inherit";}</script></body></html>chevron_rightfilter_noneOutput:
- Before Click:
- After Click:


Note: Use MozColumnRule for Mozilla Firefox.
Supported Browsers: The supported browser by HTML | DOM Style columnGap Property
are listed below:
- Google Chrome
- Edge
- Opera
- Safari
Recommended Posts:
- HTML | DOM Style backgroundClip Property
- HTML | DOM Style borderTop Property
- HTML | DOM Style boxSizing Property
- HTML | DOM Style borderImageSource Property
- HTML | DOM Style wordBreak Property
- HTML | DOM Style pageBreakBefore Property
- HTML | DOM Style borderImageOutset Property
- HTML | DOM Style maxHeight Property
- HTML | DOM Style columnRuleWidth Property
- HTML | DOM Style transitionTimingFunction property
- HTML | DOM Style zIndex Property
- HTML | DOM Style overflowY Property
- HTML | DOM Style borderTopLeftRadius Property
- HTML | DOM Style order Property
- HTML | DOM Style minWidth Property
- HTML | DOM Style visibility Property
- HTML | DOM Style animationTimingFunction Property
- HTML | DOM Style tabSize Property
- HTML | DOM Style backgroundColor Property
- HTML | DOM Style columnRule Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh


