I’m trying to figure out what would be in the leftover space?
If each td is only 15px tall, and the tbody is 350px tall, where’s that extra space going to be? It has to be in the td’s.
Also, tfoot must come before tbody. Strange, but that’s the rule.
thead
then tfoot
then tbody(s)
Also I remember people making tables 100% back in the Bad Old Days… and actually height was never an allowed property of tables.
But, I would think that so long as you did the usual 100% height setup, that you could get the table to be 100% height of the viewport. Problem is the td’s will have to stretch to fill it.
html, body {
height: 100%;
}
table is direct child of body, so this would work on any non-table… I assume it would work on a table too:
table {
min-height: 100%;
}
What is #content_1? Is it part of the table still or is it something else like a footer? Is it a fixed height?
You have the table background as yellow but you can’t divorce the table cells from the table. To do what you wanted you could have one table cell stretching to 100% height and then place a nested table inside that table cell which will then just be a normal content height table.
I assume we are talking about tabular data here anyway otherwise a table is not the right approach and actually harder than a css version in most cases.
What is #content_1? Is it part of the table still or is it something else like a footer? Is it a fixed height?
#Content_1 is something else present on the page for example a div .
About the footer imagine it always present at the bottom of the table.
I assume we are talking about tabular data here anyway otherwise a table is not the right approach and actually harder than a css version in most cases.
Yes of course. It is necessary the precence of a table.
Now I put a better images to describe my situation. Sorry for being so few comprehensible
The table has fixed header and fixed footer and it is scrollable.
I already have a scrolling table but i’m unable to fit dynamically the height to #content1.
i have omitted to say the details about the scrolling table and fixed header and footer because I thought they was useless to resolve the problem.
There are also labels columns in the header and in the footer that describe the content of the columns in the table.
So they would be always visible during scrolling.
If the table header and table footer are part of the same table then I don’t think you can do it. If the table header and footer can be separated from the table then you could do it as in my example above.
Perhaps if you posted your code for your scrolling table so we could see what you have got working so far then it might help in coming to a solution. Scrolling table content is very awkward at the best of times.
I have taken this code from this site years ago: http://www.agavegroup.com/?p=31
It’s very useful also with width 100%. but I have not been able to fit the height of the table to the page, or till the top of something else div below this table.
The only browser that comes close is Firefox but all others are broken badly.
I was quite surprised when you said you had a table with scrolling header and footer because the only ones that I’ve seen that work without javascript are the ones that I’ve done (and used in an old css quiz)
I’ve had a play around and I think this is really a step too far but I got quite close with this which seems to work in IE6 - 8 and other browsers although is very convoluted and hacky.
I used a blank last tablerow which I set to 100% height so that it pushed all the other cells out of the way and stopped them stretching.
The fixed header and footer are created with absolute p elements removed from the thead and tfoot. They can’t really be changed or positioned any better though.
The only browser that comes close is Firefox but all others are broken badly.
Yeah I’ve used it only with Firefox.
You may be able to make something with it.
Yes for sure!
I used a blank last tablerow which I set to 100% height so that it pushed all the other cells out of the way and stopped them stretching.
The fixed header and footer are created with absolute p elements removed from the thead and tfoot. They can’t really be changed or positioned any better though.
Ok I have seen that. I will change the width of some columns. I think that there will not be any problem doing that.