Collapse Borders

The border-collapse property sets whether the table borders are collapsed into a single border or separated:

HTML file: Displayed by browser:
<style>
table {
   border-collapse: collapse;
}
table, th, td {
   border: 1px solid black;
}
</style>
<body>
<table>
    <tr>
        <th>First Name</th>
        <th>Last Name</th>
    </tr>
    <tr>
        <td>Peter</td>
        <td>Griffin</td>
    </tr>
    <tr>
        <td>Lois</td>
        <td>Griffin</td>
    </tr>
</table>
<p><b>Note:</b> If a !DOCTYPE is not specified, the border-collapse property can produce unexpected results in IE8 and earlier versions.</p>
</body>
First Name Last Name
Peter Griffin
Lois Griffin

Note: If a !DOCTYPE is not specified, the border-collapse property can produce unexpected results in IE8 and earlier versions.


Back button Table of Contents Next button