Why doesn't the border show around tbody
in the following? I tried rules="groups"
and the border appears, but only between the two tbody
sections and it is collapsed.
table.sectioned tbody { border: 2px solid black; border-collapse: separate; border-spacing: 4px; }
<table class="sectioned"> <tbody> <tr><td colspan="2"><b>General Data</b></td></tr> <tr><td>Tail Number</td><td>N0809021</td></tr> <tr><td>Type of Ownership</td><td>personal</td></tr> <tr><td>Type of Aircraft</td><td>aircraft under 13,000 pounds</td></tr> <tr><td>Year of Manufacture</td><td>1999</td></tr> <tr><td>Use of Aircraft</td><td>private</td></tr> <tr><td>Start Date</td><td></td></tr> <tr><td>Policy Length</td><td>6 months</td></tr> </tbody> <tbody> <tr><td colspan="2"><b>Additional Aircraft Information</b></td></tr> <tr><td>Manufacturer</td><td></td></tr> <tr><td>Model</td><td></td></tr> <tr><td>Engine Make</td><td></td></tr> <tr><td>Number of Seats</td><td></td></tr> </tbody> </table>
Borders can be applied to most HTML elements within the body. To make a border around an element, all you need is border-style . The values can be solid , dotted , dashed , double , groove , ridge , inset and outset . Basic border styles.
To create table border in HTML, the border attribute was used. But the introduction of HTML5, deprecated the border tag. Create table border using the CSS property border. Set table border as well as border for <th> and <td>.
The HTML <table> border Attribute is used to specify the border of a table. It sets the border around the table cells. Attribute Values: 1: It sets the border around the table cells.
Add:
table {border-collapse: collapse;}
FIDDLE
Add display:block to your tbody style. Try this
tbody{ display:block; border: 2px solid black; border-collapse: separate; border-spacing: 4px; }
You can test it out on this fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With