HTML CSS examples for CSS Property:border-collapse
The border-collapse CSS property specifies whether the cell borders of a table are collapsed in a single border or separated as usual.
In the collapsing borders model, adjacent table cells share borders.
The following table summarizes the usages context and the version history of this property.
Item | Value |
---|---|
Default value: | separate |
Applies to: | The table and inline-table elements |
Inherited: | Yes |
Animatable: | No. |
The syntax of the property is as follows:
border-collapse: separate | collapse | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
separate | Selects the separated borders model. Default value. |
collapse | Selects the collapsing borders model. |
initial | Sets this property to its default value. |
inherit | takes the value of its parent element border-collapse property. |
The example below shows the border-collapse property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS border-collapse property</title> <style type="text/css"> table {<!--from w ww .jav a 2 s. c o m--> border-collapse: collapse; } table, th, td { border: 1px solid black; } </style> </head> <body> <table> <tbody> <tr> <th>Name</th> <th>Email</th> </tr> <tr> <td>Alax</td> <td>a@example.com</td> </tr> <tr> <td>Joy</td> <td>b@example.com</td> </tr> </tbody> </table> </body> </html>