www.webdeveloper.com
Results 1 to 5 of 5

Thread: Table issue

  1. #1
    Join Date
    Jan 2006
    Posts
    29

    Question Table issue

    Hello,

    I want to create a header-body-footer table for a web page, the header and footer are fine, but my problem is with the body section. I want to divide it into three cells and I want the middle cell to be 800 pixels in width and centered to the middle, and I want the left and right cells to take the rest of the remaining percent of the page width (if any). I don't want to make their width fixed in terms of pixels, but rather I want it to be in terms of percentage. (Each cell would have a width of: (100% - 800 pixels "width of the middle cell")/2 ) Is there any way to do that?

    Here's the table's code:

    HTML Code:
    <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
      <!-- MSTableType="layout" -->
      <tr>
        <td valign="top" width="100%" height="100" colspan="3">
        <!-- MSCellType="ContentHead" -->
        &nbsp;</td>
      </tr>
      <tr>
        <td valign="top" width="???">
        <!-- MSCellType="NavBody" -->
        &nbsp;</td>
        <td valign="top" width="800" align="center">
        <!-- MSCellType="ContentBody" -->
        &nbsp;</td>
        <td valign="top" width="???">
        <!-- MSCellType="NavBody2" -->
        &nbsp;</td>
      </tr>
      <tr>
        <td valign="top" width="100%" height="100" colspan="3">
        <!-- MSCellType="ContentFoot" -->
        &nbsp;</td>
      </tr>
    </table>
    Last edited by chem3; 01-12-2006 at 06:50 AM.

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Tables are not for layout. Hie yourself to the CSS forum for the solution.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Jan 2006
    Posts
    29
    Quote Originally Posted by Charles
    Tables are not for layout. Hie yourself to the CSS forum for the solution.
    But I am not good at CSS!
    Isn't there any way to do that with my table above?

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Obviously you're not that good at HTML either or you wouldn't be asking this question. Either the "tag soup" solution or the CSS one you're going to have to learn it. And if you're going to learn something you might as well learn the right one. Hie yourself to the CSS forum!
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    Nov 2005
    Location
    The best country in the world, Texas!
    Posts
    251
    There is indeed a way to do it with your table above, but here's the CSS, which is both more correct and should provide better results.

    Code:
    <html>
    <head>
    <style type="text/css">
    #header { width: 100%; height: 100px; }
    #content { margin: auto; width: 800px; }
    #footer { width: 100%; height: 100px; }
    </style>
    <body>
    <div id="header">Header</div>
    <div id="content">Content</div>
    <div id="footer">Footer</div>
    </body>
    </html>
    Last edited by Cytael; 01-12-2006 at 10:46 PM. Reason: silly me left off the ending code tag...
    WARNING: Use code provided at your own risk!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles