SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Table height issue in IE7

    Hi there,

    I have this code:

    ---

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
       <title>Test</title>
    
       <style type="text/css">
           html, body
           {
                   margin: 0;
                   padding: 0;
                   border: 0;
                   height: 100%;
                   width: 100%;
           }
       </style>
    
    </head>
    <body>
    
       <table id="mainTable" cellpadding="0" cellspacing="0"
    style="height: 100%; width: 100%;">
    
       <tr id="header" style="height: 60px;">
           <td style="background-color: yellow;">header</td>
       </tr>
    
       <tr id="contents" style="height: 100%;">
           <td style="background-color: red;">contents</td>
       </tr>
    
       <tr id="footer" style="height: 60px;">
           <td style="background-color: blue;">footer</td>
       </tr>
    
       </table>
    
    </body>
    </html>
    ---

    It works fine in Firefox (I have a table with the maximum screen height and no scrollbars).

    In IE7 I get a vertical scrollbar and the table looks larger (in height) than it should be.

    I don't understand.... What am I doing wrong?

    How can I have the same Firefox appearence in IE7?

    Thanks!

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this table for layout purposes, or are you planning on using this table to contain tabular data?

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For layout...

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, is there any particular reason why you're using a table for this particular layout? (Yes, I prefer CSS and semantic markup for my layouts, but I'm not going to shove it down your throat. I've also found in my personal experience that using tables for layout to be an extreme pain in the neck. Let me check with someone I know who's very good with layout tables; he may be able to help you better than I can should you wish to stick with them.)

  5. #5
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I don't have much choice.

    I am using webparts and it renders as tables. It is internal Microsoft code.

    But I need this behavior of 100% height to work correctly.

    This small layout that I posted is a simulation of the webparts scenario that I have.

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •