CSS Border Collapse

In CSS, the CSS border-collapse property defines as it allows you which a border should be displayed around a table cell.

you need to set the appropriate values of the CSS border-collapse property to display the border of your table in

different styles, therefore, table cell borders should collapse together or remain separate.

CSS syntax for Border Collapse

The main purpose in CSS border-collapse property for use on elementstable (like a table through display: inline-table or display: table).

There are two values which are used mostly:

1. separate (default) – when using separate value for border-collapse, all table cells have their own independent

borders and there may be space between those cells as well.

finally, the effect comes, When cells are separated, the distance between cells is defined by the border-spacing property.

2. collapse – when using collapse value in which both the space and the borders between table cells collapse

therefore there is only one border and no space between cells.

therefore, the effect comes, When cells are collapsed, the border-style value of inset behaves like groove, and outset

behaves like the ridge.


Collapse Border and seprate border example
Therefore, as seen in the above example when we select border-collapse value to collapse the table cell collapse

an outer border with each other and in another border-collapse value is separate the table cell,  separated with each other.

Collapse Border Example


collapse border

IN the above example, see that border-collapse property value use collapse, table cell collapse with each other such as employee name column and Father Name column.