Little Web Hut

CSS 2.1 Reference: border-collapse Property

CSS border-collapse Property
Syntax
selector {border-collapse: value;}
  • value is specified by using one of the following keywords: collapse, separate, or inherit.
Usage

The border-collapse property is used with tables to specify whether borders surrounding table cells are separate from, or shared with (collapsed into a single border), adjacent table borders.

This property is specified by using a keyword according to the syntax shown above.


CSS Example: The border-collapse properties are set to collapse and separate.
  #tst1 {border-collapse: collapse;}
  #tst2 {border-collapse: separate;}
  th, td {border: thin solid;}
  table {display: table;
         border: thin solid;
         width: 300px;
         margin: 20px;
  }
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style

Keywords
  • collapse - Borders surrounding table cells are shared with (collapsed into a single border) adjacent table borders.
  • separate - Borders surrounding table cells are separate from adjacent table borders.
  • inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element. If inherit is used with the root element, then the initial value for this property will be used.
Applies To Elements that have a display property value of table or inline-table.
Inherited Yes
Initial Value separate


border-collapse Property Examples
Test It HTML StyleTest It HTML StyleTest It HTML5 StyleThe border-collapse properties are set to collapse and separate.