By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

height="100%" in a table -- how to do it right?

P: n/a
Hi guys,

I'm using a height="100%" attribute in a <table> tag to get the
obvious effect (a table which fills the entire available
space). html-tidy, however, complains that this is proprietary,
i.e. not officially supported (in Opera it looks good though). Is
there an accepted way of accomplishing this?

Thanks,
**Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Daniel Haude:
I'm using a height="100%" attribute in a <table> tag to get the
obvious effect (a table which fills the entire available
space). html-tidy, however, complains that this is proprietary,
i.e. not officially supported (in Opera it looks good though). Is
there an accepted way of accomplishing this?


Surely you've heard about CSS. That's the accepted way of doing most
anything that has to do with presentation of HTML. If you haven't
started learning CSS yet, start today.

In CSS (preferrably in an external file) you can write this:

table { height: 100%; }

--
Bertilo Wennergren <be******@gmx.net> <http://www.bertilow.com>

Jul 20 '05 #2

P: n/a
On Tue, 25 Nov 2003 17:07:21 +0100,
Bertilo Wennergren <be******@gmx.net> wrote
in Msg. <bp*************@news.t-online.com>
In CSS (preferrably in an external file) you can write this:

table { height: 100%; }


I can, and I did, but it didn't do anything (in Opera. I haven't
gotten around to testing with other browsers yet). That's why I
asked.

--Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)
Jul 20 '05 #3

P: n/a
Daniel Haude:
Bertilo Wennergren <be******@gmx.net> wrote
In CSS (preferrably in an external file) you can write this:
table { height: 100%; }

I can, and I did, but it didn't do anything (in Opera. I haven't
gotten around to testing with other browsers yet). That's why I
asked.


It probaly does work, but not in the way you intended. The table
probably takes up 100% of the height _of its parent_. That parent is
probably the "body". But the body has probably just as much height as is
needed, which might not be the entire viewport. So you might need to set
100% height for "body" as well:

body { height: 100%; }

And if you're using XHTML you might need to set 100% height for the
parent of "body" as well:

html { height: 100%; }

Watch out for margin and padding. You might wind up making body or html
higher than the entire viewport. So add a few doses of "margin: 0" and
"padding: 0".

This is insidious stuff, and I'm not sure I understand everything about it.

--
Bertilo Wennergren <be******@gmx.net> <http://www.bertilow.com>

Jul 20 '05 #4

P: n/a
Bertilo Wennergren wrote:
Daniel Haude:
Bertilo Wennergren <be******@gmx.net> wrote
In CSS (preferrably in an external file) you can write this:
table { height: 100%; }

I can, and I did, but it didn't do anything

It probaly does work, but not in the way you intended. The table
probably takes up 100% of the height _of its parent_.


Only if the parent has its height specified.
--
David Dorward http://dorward.me.uk/
Jul 20 '05 #5

P: n/a
On Tue, 25 Nov 2003 18:53:16 +0100,
Bertilo Wennergren <be******@gmx.net> wrote
in Msg. <bq*************@news.t-online.com>

(and others, too)

Thanks for the help, it works now.

--Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.