border-collapse
Description
border-collapse
property controls
if to merge two borders, collapse to one border.
Item | Value |
---|---|
Initial value | separate |
Inherited | Yes. |
Version | CSS2 |
JavaScript syntax | object.style.borderCollapse="collapse" |
Syntax and Property Values
border-collapse: collapse | separate | inherit
The property values are listed in the following table.
Value | Description |
---|---|
collapse | Borders are collapsed into a single border |
separate | Borders are detached. Default value |
inherit | Inherit the border-collapse property from the parent element |
Example
<!DOCTYPE HTML>
<html>
<head>
<style>
table {<!-- w w w. j av a2s. com-->
background-color: #efefef;
width: 350px;
border-collapse: separate;
empty-cells: hide;
}
td {
padding: 5px;
border-style: solid;
border-width: 1px;
border-color: #999999;
}
</style>
</head>
<body>
<table>
<tr>
<th></th>
<th>Title one</th>
<th>Title two</th>
</tr>
<tr>
<th>Row Title</th>
<td>value</td>
<td>value</td>
</tr>
<tr>
<th>Row Title</th>
<td>value</td>
<td></td>
</tr>
</table>
</body>
</html>
The code above generates the following result.