Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a table to fill 100% height in a td

I'm trying to rewrite a site in proper HTML. The site I'm trying to replace was a complete mess. I've run into a problem where I can't get a <table> to fill the height of the <td> it's contained in. I've tried setting height: 100% on the <table>, which based on google and stackoverflow research should work, but I must be missing something stupid. I had tried to do the same thing with <divs> before switching to tables, but I'm not opposed to going back to <divs> if someone can suggest how to do it.

The content I'm developing is currently here: http://96.0.22.228/

Due to project time constraints, I've had to use bad hacks to get the pages looking correctly. I'm not declaring a <doctype> and I'm forcing IE to use IE7-quirks mode. I'd love to have recommendations on how to do this layout in a proper manner using HTML5 and CSS. It does not have to support older browsers, but it does have to look the same in the latest versions of Chrome, Firefox and IE. I'd also like to to do away with the images for the menus and style everything in CSS for the border frames and the menu text.

Even though I've had to complete the site as is, I'm open to going back and fixing it later if there's a good answer to this problem.

like image 844
TheDavidFactor Avatar asked Mar 26 '12 02:03

TheDavidFactor


1 Answers

100% height in a table cell is always a pain. Technically speaking a TD has no height (because that depends on its contents). What you are asking the browser to do is make the child 100% of its parent, which is 100% of its child, which is 100% of its parent ... You can see how that might be a problem.

You could try adding an explicit height to the TD and using table-layout:fixed on the table. At least that way the browser knows the height of the parent without needing the height of the child but that still may not work.

You might need to rethink how you go about this.

like image 181
SpliFF Avatar answered Sep 30 '22 01:09

SpliFF