What is border-collapse property in CSS?

The `border-collapse property is used to set the collapsing border models of a table.

Syntax

The syntax of the border-collapse property is as follows:

border-collapse: separate|collapse|initial|inherit;

Possible values

The `border-collapse property can take the following values:

  • Separate: This is the default value. Borders are separate. Each cell will have its own border
  • Collapse: Borders are combined into a single border for all cells (where possible)
  • Initial: Sets border spacing to the default value
  • Inherit: Inherits border-spacing from its parent element

Example

The snippet below shows the difference between separate and collapse border models in CSS:

  • HTML
  • CSS (SCSS)

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved