What is the CSS border-spacing property?

The border-spacing property in CSSCascade Style Sheets is used to set the distance between the borders of cells.


This property is only used when the border-collapse property is set to separate.


Syntax


border-spacing: length|initial|inherit;

Property values

  • length: Sets the values in px, cm, pt, etc. to define the distance between the borders.

    If two values are defined, then the first value represents the horizontal space and the second value represents the vertical space.

  • initial: Sets the value to its default value.

  • inherit: Inherits property from its parent value.

Code

Below is the basic HTMLHyperText Markup Language & CSS code to demonstrate the use of the border-spacing property.

Free Resources