Get the TD to take as much height as possible

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Get the TD to take as much height as possible

Post by pilau »

I tried to set the height of the TD (it's id is container_td) to 100% on CSS, and it won't work.
What could be preventing me from doing so?
By the way I am using DTD loose.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

From what I remember using tables for layouts, it wasn't (isn't) permitted to set TD heights in percentage. Tables aren't made for layouts so it's a non-standard idea. Maybe I'm wrong (I often am). XHTML (CSS and <DIV> elements) should get you there though ;)
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

Ok. Maybe you'll know the answer to this one: How can I "snap" a DIV (or a TR) to the bottom of the window?
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

pilau wrote:Ok. Maybe you'll know the answer to this one: How can I "snap" a DIV (or a TR) to the bottom of the window?
either by <div valign="bottom"> or JavaScript:

Code: Select all

document.onload = some_func;

function some_func (e) {
  obj = document.getElementById('some_id');
  obj.style.top = parseInt(obj.height);
}
I got this off the top of my head, so it can be wrong, but it should be something roughly similar. :wink:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Do you mean make it sit on the bottom of the screen?

There's two CSS attributes for this.

Code: Select all

position: fixed;
bottom: 0;

/* or */
position: absolute;
bottom: 0;
The first method makes the div stay there even when you scroll up and down. It behaves like the second one in IE though (bug).

The second method puts it at the bottom of the screen when the page loads but will move with the page when you scroll
Post Reply