CSS - border-collapse
border-collapse
controls if the borders of a table element should collapse into a single border or be seperated
Property Variable Name
border-collapse
Available Values for border-collapse
separate|collapse|initial|inherit
Examples Using border-collapse values
Example using border-collapse separate
Example using border-collapse separate
Here is an example using border-collapse:separate;
Table Cell 1 | Table Cell 2 |
Table Cell 3 | Table Cell 4 |
Code
<style>
/* Some Styles so we can see the element */
.demo-table-1 {
background:#999;
margin-bottom:10px;
height:220px;
width:100%;
/*display: flex;
flex-wrap: wrap;*/
color:#FFF;
align-items: center;
justify-content: center;
border:3px solid #000;
}
.demo-table-1 td {
padding:3px;
border:3px solid #111;
}
.demo-table-1 {
/* this is the test property */
border-collapse:separate;
}
</style>
<h2>Example using border-collapse separate</h2>
<p>Here is an example using <code>border-collapse:separate;</code></p>
<table class='demo-table-1'>
<tbody>
<tr>
<td>Table Cell 1</td>
<td>Table Cell 2</td>
</tr>
<tr>
<td>Table Cell 3</td>
<td>Table Cell 4</td>
</tr>
</tbody>
</table >
Example using border-collapse collapse
Example using border-collapse collapse
Here is an example using border-collapse:collapse;
Table Cell 1 | Table Cell 2 |
Table Cell 3 | Table Cell 4 |
Code
<style>
/* Some Styles so we can see the element */
.demo-table-2 {
background:#999;
margin-bottom:10px;
height:220px;
width:100%;
/*display: flex;
flex-wrap: wrap;*/
color:#FFF;
align-items: center;
justify-content: center;
border:3px solid #000;
}
.demo-table-2 td {
padding:3px;
border:3px solid #111;
}
.demo-table-2 {
/* this is the test property */
border-collapse:collapse;
}
</style>
<h2>Example using border-collapse collapse</h2>
<p>Here is an example using <code>border-collapse:collapse;</code></p>
<table class='demo-table-2'>
<tbody>
<tr>
<td>Table Cell 1</td>
<td>Table Cell 2</td>
</tr>
<tr>
<td>Table Cell 3</td>
<td>Table Cell 4</td>
</tr>
</tbody>
</table >
Example using border-collapse initial
Example using border-collapse initial
Here is an example using border-collapse:initial;
Table Cell 1 | Table Cell 2 |
Table Cell 3 | Table Cell 4 |
Code
<style>
/* Some Styles so we can see the element */
.demo-table-3 {
background:#999;
margin-bottom:10px;
height:220px;
width:100%;
/*display: flex;
flex-wrap: wrap;*/
color:#FFF;
align-items: center;
justify-content: center;
border:3px solid #000;
}
.demo-table-3 td {
padding:3px;
border:3px solid #111;
}
.demo-table-3 {
/* this is the test property */
border-collapse:initial;
}
</style>
<h2>Example using border-collapse initial</h2>
<p>Here is an example using <code>border-collapse:initial;</code></p>
<table class='demo-table-3'>
<tbody>
<tr>
<td>Table Cell 1</td>
<td>Table Cell 2</td>
</tr>
<tr>
<td>Table Cell 3</td>
<td>Table Cell 4</td>
</tr>
</tbody>
</table >
Example using border-collapse inherit
Example using border-collapse inherit
Here is an example using border-collapse:inherit;
Table Cell 1 | Table Cell 2 |
Table Cell 3 | Table Cell 4 |
Code
<style>
/* Some Styles so we can see the element */
.demo-table-4 {
background:#999;
margin-bottom:10px;
height:220px;
width:100%;
/*display: flex;
flex-wrap: wrap;*/
color:#FFF;
align-items: center;
justify-content: center;
border:3px solid #000;
}
.demo-table-4 td {
padding:3px;
border:3px solid #111;
}
.demo-table-4 {
/* this is the test property */
border-collapse:inherit;
}
</style>
<h2>Example using border-collapse inherit</h2>
<p>Here is an example using <code>border-collapse:inherit;</code></p>
<table class='demo-table-4'>
<tbody>
<tr>
<td>Table Cell 1</td>
<td>Table Cell 2</td>
</tr>
<tr>
<td>Table Cell 3</td>
<td>Table Cell 4</td>
</tr>
</tbody>
</table >