Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table height 100%

Status
Not open for further replies.

kizmar2

Programmer
May 25, 2004
164
0
0
US
OK, I have a VERY simple page here and I cannot for the life of me get the table height (of 100%) to work correctly.

It is even possible to use "<table height=100%>"????

KizMar
------------
 
Why would you put this in the <table> tag? Wouldn't you use <tr style="height:100%;">?

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
That wouldn't work because I want the table itself to stretch the height of the browser window. I have more then one row and one of them has a set height. "height" is an attribute of the TABLE tag... it just doesn't ever work.

Besides I have two rows and one is a set height. =)

KizMar
------------
 
Can you trash your table and use div & span tags instead ?
I've done something like this successfully using <div style="height:100%;"> as a wrapper around a bundle of divs & spans.

Cheers, Mike.
 

style="height: 100%;" worked for me. What browser are you trying this in, and what surrounding tags do you have? The table will use 100% of the height of the surrounding tag.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
height is not a valid attribute. You may want to consider using table-less CSS layouts, which is the new cool thing. It's not necessary, but makes your website much more user-friendly.

This is the link to validate your website. Notice the first error they tell you is that there is no character encoding. A common one is

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

Which you would place between your [tt]<head></head>[/tt] tags.

Hope this was somewhat helpful.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
In the process of trying to figure out what the deal was I deleted the character encoding line. I'll replace it, thank you.

I don't know enough about how people replace tables with CSS to do that at this point. Is there a good book for this?

I was never aware that "height" is not a valid attribute of the table tag. The documentation I have says it is.

What's odd is that I'm using "height=100%" on the site I developed at work and it works like a charm (
Thank you for the HTML validation link. I'll have to utilize that in the future.

KizMar
------------
 
I noticed this is on the top of a basic HTML page in Dreamweaver.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
if you take out the " part... using height="100%" will work. I don't know why it works, but I stumbled upon this while trying to figure it out for myself.
 
Because doing that shifts browsers from using standards compliant mode into quirks mode. That shift is mostly visible with IE browsers, where standards compliant mode somewhat follows the current standards while quirks mode uses all those IE oddities we web developers love. Basically, changing from standards (using correct doctype) to quirks (deleting, using incorrect doctype) is the worst thing you can do in regards to cross-browser support of your page.
 
I'm Cory Arthus, and I approve Vragabond's response.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Sorry Kizmar, even though it's part of the spec you can't set a table height to 100%. I suggest using a DIV with the CSS height set to 100% - that may work on most newer browsers.

josh

Josh Bachynski
Senior Project Manager
SIMIAN Systems Inc.
Office: 1.204.942.8630
Email: josh@simian.ca
Sitellite 4.2 Enterprise Edition - PHP based CMS and Framework
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top