I have a table which has dynamic number of columns depending on data I receive. I have a tag which needs to spread across all columns independent of number of columns in a table.
<table>
<thead>
<tr>
<th><span>ColA</span></th>
<th><span>ColB</span></th>
<th rowspan='2'><span>Col<br/> C</span></th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td>Footer content here</td>
</tr>
</tfoot>
</table>
EDIT colspan = 0 worked for me!
<td colspan='0'>Footer content here</td>
Works on FF, Did not work for Chrome, IE8 though :(
EDIT 2
colspan = '100%' This link solved crossbrowser problem https://stackoverflow.com/a/5028091/405117
You need to set the margin of the body to 0 for the table to stretch the full width. Alternatively, you can set the margin of the table to a negative number as well. Save this answer.
The TBODY end tag may always be safely omitted. The start tags for THEAD and TFOOT are required when the table head and foot sections are present respectively, but the corresponding end tags may always be safely omitted.
Use colspan="0"
By the way, your <tfoot>
should be between <thead>
and <tbody>
tags.
EDIT: That practice, being recommended by W3C, is not cross-browser. Use carefully!
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