Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put spacing between TBODY elements

Tags:

html

css

I have a table like this:

<table>     <tfoot>         <tr><td>footer</td></tr>     </tfoot>     <tbody>         <tr><td>Body 1</td></tr>         <tr><td>Body 1</td></tr>         <tr><td>Body 1</td></tr>     </tbody>     <tbody>         <tr><td>Body 2</td></tr>         <tr><td>Body 2</td></tr>         <tr><td>Body 2</td></tr>     </tbody>     <tbody>         <tr><td>Body 3</td></tr>         <tr><td>Body 3</td></tr>         <tr><td>Body 3</td></tr>     </tbody> </table> 

I'd like to put some spacing between each tbody element, but padding and margin have no effect. Any ideas?

like image 201
nickf Avatar asked Nov 17 '08 04:11

nickf


People also ask

How do I add space between border and element?

You usually use padding to add distance between a border and a content.

Can we have 2 Tbody in a table?

You may use more than one <tbody> per table as long as they are all consecutive. This lets you divide the rows in large tables into sections, each of which may be separately formatted if so desired.


2 Answers

Something like this will work, depending on your browser support requirements:

tbody::before {   content: '';   display: block;   height: 15px;  } 
like image 160
MacNimble Avatar answered Sep 22 '22 01:09

MacNimble


Try this, if you don't mind not having borders.

<style> table {   border-collapse: collapse; }  table tbody {   border-top: 15px solid white; } </style>  <table>     <tfoot>         <tr><td>footer</td></tr>     </tfoot>     <tbody>         <tr><td>Body 1</td></tr>         <tr><td>Body 1</td></tr>         <tr><td>Body 1</td></tr>     </tbody>     <tbody>         <tr><td>Body 2</td></tr>         <tr><td>Body 2</td></tr>         <tr><td>Body 2</td></tr>     </tbody>     <tbody>         <tr><td>Body 3</td></tr>         <tr><td>Body 3</td></tr>         <tr><td>Body 3</td></tr>     </tbody> </table> 
like image 32
Dave Jensen Avatar answered Sep 20 '22 01:09

Dave Jensen