Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    container height auto, table height 100%

    Please help. I have been googling for a solution to this problem but it seems it is actually impossible to do. I am not yet 100% sure it is impossible so as a last resort I make this thread.

    The code looks like this:


    <html>
    <head>
    <title>untitled</title>
    <style>
    #container {
    position:relative;
    width:75%;
    height:auto;
    margin:10% auto;
    border:1px solid blue;
    }
    #table {
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    border:1px solid red;
    }
    #table td {
    border:1px solid yellow;
    }
    </style>
    </head>
    <body>
    <div id="container">
    <p>contents</p>
    <table id="table">
    <tr>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    </table>
    </div>
    </body>
    </html>

    This does work if #container has a specified height instead of "auto". But unless #container's height is auto this design is pointless. The point is that the absolute positioned table is going to contain images as a very nice background to the other contents inside #container.

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Yeah, right, so what are we supposed to be doing?


  •  

    Posting Permissions

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