Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make tfoot appear above tbody within the same table?

Tags:

html

jquery

I am working around a limitation of using a jquery plugin and rendering my table according to the standards, i.e. thead, tfoot and tbody in that order. The browser then correctly renders it, and makes the tfoot appear below the tbody as is supposed to do. Is there a hack/straight forward way to make the tfoot appear and render above the tbody as well?

like image 632
Siva Bathula Avatar asked Jun 20 '13 12:06

Siva Bathula


2 Answers

Something sounds wrong to me, but you can change the display type of the tfoot

tfoot {
    display: table-row-group;
}

http://jsfiddle.net/ExplosionPIlls/UMZr4/

like image 65
Explosion Pills Avatar answered Sep 21 '22 14:09

Explosion Pills


You can mess around with absolute positioning of the tfoot and tbody elements. I'm not sure how it works cross-browser and you need to know the positions. But here's an example:

table {
    position: relative;
}
tfoot {
    position: absolute;
    top: 25px;
}

tbody {
    position: absolute;
    top: 50px;
}

http://jsfiddle.net/YJhk2/

like image 38
Brandon Avatar answered Sep 19 '22 14:09

Brandon