User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 330,112 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,105 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 973 | Replies: 9
Reply
Join Date: Apr 2008
Posts: 6
Reputation: boyetp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boyetp boyetp is offline Offline
Newbie Poster

how to maximize table cell height

  #1  
21 Days Ago
Hi there,

I'm new to this forum. I need help on how to maximize a table cell height.
First I have a table layout that has 3 rows, the first and third rows have fix 50px height.
I want to max the height of the of the 2nd row to fill the remaining space.

This works fine in firefox 2 but not in IE7. the height 100% in the ie 7 causes to overlap the body which cause to create a vertical scroll bar.

how should I do this. what would be the proper value for the 2nd row? I need help.

Also if you put a nested table in the 2nd row without row height define, the 100% height table won't stretch.

here's the code:

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7. <style>
  8. html, body{
  9. height:96%;
  10. }
  11.  
  12. body{
  13. border: 1px solid red;
  14. }
  15. </style>
  16.  
  17. <body>
  18. <table border="1" cellspacing="5" cellpadding="5" style="height:100%; width:100%">
  19. <tr>
  20. <td style="width:100%;height:50px"> row 1 col 1</td>
  21. </tr>
  22. <tr>
  23. <td style="width:100%;height:100%"> row 2 col 1</td>
  24. </tr>
  25. <tr>
  26. <td style="width:100%;height:50px"> row 3 col 1</td>
  27. </tr>
  28. </table>
  29.  
  30. </body>
  31. </html>

regards,

boyetp
Last edited by peter_budo : 18 Days Ago at 7:47 pm. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Location: South Africa
Posts: 107
Reputation: Traicey is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 11
Traicey's Avatar
Traicey Traicey is offline Offline
Junior Poster

Re: how to maximize table cell height

  #2  
21 Days Ago
the height 100% in the ie 7 causes to overlap the body which cause to create a vertical scroll bar.

Im not sure if I get what you are trying to say but to eliminate the verical scroll bar you can rotate the height of the body until it suits your needs. you can achieve that by decreasing the body height

  1. <style>
  2. html, body
  3. {
  4. height:50%;
  5. }
Last edited by peter_budo : 18 Days Ago at 7:48 pm. Reason: Please use [code] for multiple lines and [icode] only for single line of code.
Being bored is an insult to oneself
Reply With Quote  
Join Date: Feb 2008
Location: bangalore
Posts: 19
Reputation: aravelli is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
aravelli aravelli is offline Offline
Newbie Poster

Re: how to maximize table cell height

  #3  
21 Days Ago
don't use height:100%
<td style="width:100%;height:100%"> row 2 col 1</td>
use height:100px
<td style="width:100%;height:100px"> row 2 col 1</td>
and find the difference
aravelli ramesh
Reply With Quote  
Join Date: Apr 2008
Posts: 6
Reputation: boyetp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boyetp boyetp is offline Offline
Newbie Poster

Re: how to maximize table cell height

  #4  
21 Days Ago
Originally Posted by Traicey View Post
Im not sure if I get what you are trying to say but to eliminate the verical scroll bar you can rotate the height of the body until it suits your needs. you can achieve that by decreasing the body height

<style>
html, body
{
height:50%;
}


Hi Traicey,

I really appreciate your replay. I already tried different percentage, the latter table is a layout and they are dynamically created based on how many gadgets/widgets that I'm going to put base on our xml cofiguration. This table can have tables inside the td.

So the table inside the table won't stretch through the length of the td.
Actually if I used quirks mode works fine but I don't want to go that route.

I really need help on this.

boyetp
Reply With Quote  
Join Date: Apr 2008
Posts: 6
Reputation: boyetp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boyetp boyetp is offline Offline
Newbie Poster

Re: how to maximize table cell height

  #5  
21 Days Ago
Originally Posted by aravelli View Post
don't use height:100%
<td style="width:100%;height:100%"> row 2 col 1</td>
use height:100px
<td style="width:100%;height:100px"> row 2 col 1</td>
and find the difference


Hi Arevelli,

I have to stretch this cell to fill up the remaining spaces.
This table can have tables inside the td.
So the table inside the table won't stretch through the length of the td.

regards,

boyetp
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,549
Reputation: peter_budo will become famous soon enough peter_budo will become famous soon enough 
Rep Power: 8
Solved Threads: 149
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

Re: how to maximize table cell height

  #6  
18 Days Ago
Why do you have CSS outside of head tag? It should be inside header tag or use inline option (inside the tag you wish to adjust with css)
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Apr 2008
Posts: 6
Reputation: boyetp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boyetp boyetp is offline Offline
Newbie Poster

Re: how to maximize table cell height

  #7  
18 Days Ago
Originally Posted by peter_budo View Post
Why do you have CSS outside of head tag? It should be inside header tag or use inline option (inside the tag you wish to adjust with css)


Hi Peter,

I can move the styles into the header or use inline style with the same result.
This is just my test page.

boyetp
Reply With Quote  
Join Date: Feb 2008
Location: bangalore
Posts: 19
Reputation: aravelli is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
aravelli aravelli is offline Offline
Newbie Poster

Re: how to maximize table cell height

  #8  
14 Days Ago
use this

  1. html, body{
  2. height:auto;
  3. }

instead of using height:96%;
Last edited by peter_budo : 13 Days Ago at 7:44 am. Reason: Keep It Organized - plase use [code] tags
aravelli ramesh
Reply With Quote  
Join Date: Apr 2008
Posts: 6
Reputation: boyetp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boyetp boyetp is offline Offline
Newbie Poster

Re: how to maximize table cell height

  #9  
14 Days Ago
Originally Posted by aravelli View Post
use this

html, body{
height:auto;
}

instead of using height:96%;


This is the default value of the height. Then my table won't maximize the screen viewport.
I need to have my table maximize the viewport screen.
Reply With Quote  
Join Date: Jan 2007
Posts: 2,210
Reputation: MidiMagic is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 75
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Posting Maven

Re: how to maximize table cell height

  #10  
11 Days Ago
There is NO way to exactly fill a screen vertically that works on all browsers, screen resolutions, and viewport sizes.

- It's impossible to make a page that fits perfectly in the vertical direction on all monitors.

- It is impossible to place anything against the bottom edge of the screen.

The Internet is not designed to work that way. It is designed to expand pages downward as much as is necessary to fit the entire content served. Screen height and the bottom edge of the screen are undefined in Internet protocols.

You can choose among these possibilities:

1. Design your page for one screen resolution, and accept the fact that people with other screen resolutions are going to see either scroll bars or a smaller page in the upper left corner.

2. Design your page for the lowest resolution, and let the remainder of the screen be blank if a higher resolution monitor displays it.

3. Design your page to fit against the top of the screen, and expand to fit the width (which does work). Use a repeating background image to fill the rest of the screen downward.

4. You could try to wrestle with JavaScript functions intended to find the screen height. But they are not standardized across browsers, and are totally undefined on many browsers.

5. You could create an image containing the entire page, and then choose a display that fits the image to the window horizontally. It will then approximately fit vertically. But it won't work right on the new widescreen monitors. And you can't have any links on this page.
Last edited by MidiMagic : 11 Days Ago at 1:38 am.
Daylight-saving time uses more gasoline
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Marketplace (Sponsored Links)
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 1:15 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC