I have a table with thead, tbody and tfoot.
The css value to display - this is a block - allows you to add a scroll bar to the body and scroll through the lines while ted and tfoot remain in place.
The width of the TD labels is not fixed, since the width of the tables changes in accordance with the width of the TD.
I would like to align TH tags with TD tags.
How can I do that? (CSS or jQuery)
Edit:
Target Browser - Google - Chrome!
And adding a little twist, the RTL table.
CSS:
tbody{ display: block; overflow: auto; } thead, tfoot{ display: block; }
HTML:
<table> <caption>My Table</caption> <thead> <tr><th>Col1</th><th>Col2</th></tr> </thead> <tbody> <tr><td>Cell11</td><td>Cell12</td></tr> <tr><td>Cell21</td><td>Cell22</td></tr> <tr><td>Cell31</td><td>Cell32</td></tr> <tr><td>Cell41</td><td>Cell42</td></tr> <tr><td>Cell51</td><td>Cell52</td></tr> <tr><td>Cell61 Is Wide</td><td>Cell62</td></tr> </tbody> <tfoot> <tr><th>6 Rows</th><th></th></tr> </tfoot> </table>
You can try using this jsFiddle .
Thank you and be happy.
jquery html css
user425445
source share