CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    80

    Html table dynamic height

    What im trying to do is to get this page to expand in height to the size of the client browser. I have the header, the menubar, and the footer a specific heights but I want the content part of the table to expand to the rest of the width of the page so it is always full screen in width. Here is my code, and if someone could help me figure it out would be great. Thanks.

    Code:
    <style>
    html,body
    {
    	margin:0;
    	height:100%;
    	cellpadding:0;
    	cellspacing:0;
    }
    </style>
    
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="780">
        <tr>
          <td background="images/xcessivelayout_02.gif" height="231">&nbsp;</td>
        </tr>
        <tr>
          <td background="images/xcessivelayout_04.gif" height="26">&nbsp;</td>
        </tr>
        <tr>
          <td background="images/xcessivelayout_05.gif" height="100%">&nbsp;</td> <!-- THIS TD/TR NEEDS TO FILL THE REST OF THE HEIGHT OF THE PAGE -->
        </tr>
        <tr>
          <td background="images/xcessivelayout_06.gif" height="26">&nbsp;</td>
        </tr>
      </table>
      </center>
    </div>

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Html table dynamic height

    First of all, body and html do not have height properties.

    Second, when declaring 100%, you can't use other heights in your TD because 100% is already in use. Simply make the whole table 100% and omit that TDs height.

    HTML Code:
    <style>
    html,body
    {
    	margin:0;
    	cellpadding:0;
    	cellspacing:0;
    }
    </style>
    
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="780" height=100%>
        <tr>
          <td background="images/xcessivelayout_02.gif" height="231">&nbsp;</td>
        </tr>
        <tr>
          <td background="images/xcessivelayout_04.gif" height="26">&nbsp;</td>
        </tr>
        <tr>
          <td background="images/xcessivelayout_05.gif">&nbsp;</td> <!-- omit this height table height will do the rest -->
        </tr>
        <tr>
          <td background="images/xcessivelayout_06.gif" height="26">&nbsp;</td>
        </tr>
      </table>
      </center>
    </div>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Sep 2004
    Posts
    80

    Re: Html table dynamic height

    That worked. Thanks. Looks like i need to catch back up on my HTML

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Html table dynamic height

    You're welcome. And don't forget your CSS.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured