What do you think about it?
<style> .table { width: 100%; display:table; border-collapse: collapse; } .tr { height: 60px; display:table-row; border: 1px solid Black; } .td, .th{ height: 60px; border: 1px solid Black; display:table-cell; background: -webkit-linear-gradient(top, #ccc 0%, #888 100%); } </style> <div class="table"> <div class="tr"> <div class="th"></div> </div> <div class="tr"> <div class="td"></div> </div> <div class="tr"> <div class="td"></div> </div> </div>
It is better to use DIV instead of tables. You can do the same with minor changes. And itβs better for you to add CSS built-in to HTML if you work in PDF format or send via email as a template.
UPDATE:
You can do it:
<style> table { width: 100%; border-collapse: collapse; } th { height: 60px; } td{height: 100px;} td, th { background: -webkit-linear-gradient(top, #ccc 0%, #888 100%); border: 1px solid Black; } </style> <table> <tr> <th></th> </tr> <tr> <td></td> </tr> <tr> <td></td> </tr> </table>
or jQuery to replace tables with nested divs:
<style> .table { width: 100%; display:table; border-collapse: collapse; } .table .tr{ display:table-row; } .table .th{ height: 60px; font-weight:bold; } .table .td{height: 100px;} .table .th, .table .td { border: 1px solid Black; display:table-cell; background: -webkit-linear-gradient(top, #ccc 0%, #888 100%); } </style> <table> <tr> <th>a</th> </tr> <tr> <td>b</td> </tr> <tr> <td>c</td> </tr> </table> <script> $(document).ready(function(){ $("table").each(function(a,table){ var i=a; $(table).after('<div class="table" id="table-'+i+'"></div>'); var currentTH = $(this).parent().find('th'); $(currentTH).each(function(){ var content=$(this).html(); $('#table-'+i).append(' <div class="tr"><div class="th">'+content+'</div></div>'); }); var currentTD = $(this).parent().find('td'); $(currentTD).each(function(){ var content=$(this).html(); $('#table-'+i).append(' <div class="tr"><div class="td">'+content+'</div></div>'); }); $(this).remove(); }); }); </script>
source share