CSS border-spacing Property
The border-spacing Property is used to set the distance between the borders of neighboring cells in the Table. This property works only when the border-collapse property is set to no-collapse separate.
Syntax:
border-spacing: length|initial|inherit;
Property values:
- length-length: It is used to set the distance between the borders of adacent cells. It does not allow negative values.
- If two values are defined, first value defines the horizontal space and second value defines the verical spacing.
- If only one value is given then it defines the both horizontal and vertical spacing between the adjacent borders of cells.
Syntax:
border-spacing:length-length;
Example-1:
<!DOCTYPE html><html><head><title>border-spacing property</title><style>table,th,td {border: 2px solid green;text-align: center;}#geeks {border-collapse: separate;background-color: none;border-spacing: 20px 40px;}h1 {color: green;}</style></head><body><center><h1>GeeksforGeeks</h1><h2> The border-spacing Property</h2><h3>border-spacing: 20px 40px;</h3><tablestyle="width:70%"id="geeks"><tr><th>Firstname</th><th>Lastname</th><th>Age</th></tr><tr><td>Harsh</td><td>Agarwal</td><td>15</td></tr><tr><td>Manas</td><td>Chhabra</td><td>27</td></tr><tr><td>Ramesh</td><td>Chandra</td><td>28</td></tr></table></center></body></html>chevron_rightfilter_noneOutput:

- initial: It sets the property to its default value.
Syntax:
border-spacing:initial;
Example-2:
<!DOCTYPE html><html><head><title>border-spacing property</title><style>table,th,td {border: 2px solid green;text-align: center;}#geeks {border-collapse: separate;background-color: none;border-spacing: initial;}h1 {color: green;}</style></head><body><center><h1>GeeksforGeeks</h1><h2> The border-spacing Property</h2><h3>border-spacing: initial;</h3><tablestyle="width:70%"id="geeks"><tr><th>Firstname</th><th>Lastname</th><th>Age</th></tr><tr><td>Harsh</td><td>Agarwal</td><td>15</td></tr><tr><td>Manas</td><td>Chhabra</td><td>27</td></tr><tr><td>Ramesh</td><td>Chandra</td><td>28</td></tr></table></center></body></html>chevron_rightfilter_noneOutput:

Supported Browsers: The browser supported by css border-spacing property are listed below:
- Google Chrome 1.0
- Internet Explorer 8.0
- Firefox 1.0
- Opera 4.0
- Safari 1.0
Recommended Posts:
- HTML | DOM Style borderSpacing Property
- CSS | transition-property Property
- CSS | nav-down property
- CSS | nav-right property
- CSS | all Property
- CSS | right Property
- CSS | top Property
- CSS | nav-up property
- CSS | cursor property
- CSS overflow-y Property
- CSS | transition Property
- CSS | left Property
- CSS | clip Property
- CSS | perspective Property
- CSS | resize 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.

