Jump to content


Table Height =100% *sigh*...


6 replies to this topic

#1 pizzaboy

    Young Padawan

  • Members
  • Pip
  • 22 posts

Posted 29 November 2005 - 05:14 AM

I've got 2 tables and I'm trying to get them so they both have the same height.

My code looks like this:

  <tr>
	<td><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="table1">
// 6 rows...
	  <tr>
		<td> </td>
	  </tr>
	</table></td>
	<td><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0" id="table2">
// 2 rows...
	  <tr>
		<td> </td>
	  </tr>
	</table></td>


Is there a problem with setting the height of a table to 100% or am I just using it incorrectly? I've even tried changing the table heights within CSS (#table1, #table2 { height: 100%; } ), but no success there either...

Whats going on? :(

Any help is appreciated, thanks. :D

#2 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 29 November 2005 - 08:14 AM

should the <tr> and <td> tags be inside the tables? not the tables inside the <tr> and <td>...

#3 Squid

    Young Padawan

  • Members
  • Pip
  • 132 posts
  • Location:Netherlands
  • Interests:Webdesign, php coding, visual basic programming

Posted 29 November 2005 - 09:58 AM

^Agreed

But, the more rows you insert into the table, the higher it will get. So, 6 rows will be higher than 2 rows.

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 29 November 2005 - 04:59 PM

Actually, if he has a table tag before the first <tr> he posted, then it's fine.
And he wants to make the table as is, the full height of the screen, not just add content to make it higher.

First rule of CSS. An element can only be as tall or wide as it's containing element when using % sizes.
In other words, try making the columns or row or table containing those tables have the height:100%

#5 raenef

    Code Enforcer

  • Members
  • PipPipPip
  • 540 posts
  • Location:Battle Creek, Michigan
  • Interests:Web Development and Graphic Design

Posted 29 November 2005 - 06:09 PM

True, also are your html and body set to 100% as well?
http://www.quirksmod...percheight.html

#6 pizzaboy

    Young Padawan

  • Members
  • Pip
  • 22 posts

Posted 30 November 2005 - 03:05 AM

Problem solved!!!

Although it sounds obvious, I obviously needed reminding that 6 rows and 2 rows would never be the same height!

The way around my problem was making both tables of equal rows and setting their heights to the largest of the 2 tables (in pixels). The original content (6 rows from table1 and 2 rows from table2) were then inserted inside the new tables to visually hide the fact that the tables were not of the same height.

Anyway, my conclusion is still... What the hell is the Table Height=...% supposed to do??? :doh:


Thanks for the help guys!! :D

#7 Wybe

    Jedi In Training

  • Members
  • PipPip
  • 399 posts
  • Gender:Male
  • Location:the Netherlands
  • Interests:Graphic design, digital and traditional, street style, graffiti, guerilla drawing, typography, coding, sex

Posted 01 December 2005 - 04:31 PM

It's supposed to make <table> the height in percentages of the container it's in.

the height attribute is not recognized in certain versions (if not all) XHTML. You better do it using CSS ;) it's the same but in CSS it validates, lol.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users