Positioning divs, but WITHIN table cells?

Discussion in 'HTML' started by mj.redfox.mj@gmail.com, Nov 23, 2006.

  1. Guest

    Hi,

    I wonder if someone can help me. Re my code below, I'm trying to
    position some divs within table elements. What I'd like to do is for
    each table row to contain a group of positioned divs. The problem I
    have is that whereas I'd like the table row to somehow automatically
    expand its height to contain all the divs in it (in the same way a
    table normally does whenever text etc is entered into it),
    unfortunately it doesn't appear to do this, and any subsequent rows
    appear underneath the divs from the previous row.

    Does anyone know how I can get the table row/columns to recognize the
    height of the (albeit absolutely positioned) divs that they contain?


    <table width="100%">

    <tr>
    <td width="100%" style="position: relative">
    <div style="position: absolute; left: 4px; top: 4px; z-index:
    30; width: 100%">
    <!-- CODE BLOCK 1 GOES HERE -->
    </div>

    <div style="position: absolute; left: 24px; top: 24px; z-index:
    20; width: 100%">
    <!-- CODE BLOCK 2 GOES HERE -->
    </div>
    </td>
    </tr>


    <tr>
    <td width="100%" style="position: relative">
    <div style="position: absolute; left: 4px; top: 4px; z-index:
    30; width: 100%">
    <!-- CODE BLOCK 3 GOES HERE -->
    </div>

    <div style="position: absolute; left: 24px; top: 24px; z-index:
    20; width: 100%">
    <!-- CODE BLOCK 4 GOES HERE -->
    </div>
    </td>
    </tr>

    </table>
    , Nov 23, 2006
    #1
    1. Advertising

  2. Els Guest

    wrote:

    > Does anyone know how I can get the table row/columns to recognize the
    > height of the (albeit absolutely positioned) divs that they contain?


    Nope, they just won't.
    Instead of using position:absolute, give the table cells the desired
    left and top padding.

    --
    Els http://locusmeus.com/
    accessible web design: http://locusoptimus.com/

    Now playing: Turtles - Happy Together
    Els, Nov 23, 2006
    #2
    1. Advertising

  3. Guest

    Thank you my friend! You're a genius.

    Els wrote:
    > wrote:
    >
    > > Does anyone know how I can get the table row/columns to recognize the
    > > height of the (albeit absolutely positioned) divs that they contain?

    >
    > Nope, they just won't.
    > Instead of using position:absolute, give the table cells the desired
    > left and top padding.
    >
    > --
    > Els http://locusmeus.com/
    > accessible web design: http://locusoptimus.com/
    >
    > Now playing: Turtles - Happy Together
    , Nov 23, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    522
  2. rich
    Replies:
    0
    Views:
    718
  3. UJ
    Replies:
    8
    Views:
    61,210
  4. Siegfried Heintze
    Replies:
    1
    Views:
    105
    pcx99
    May 1, 2004
  5. maya
    Replies:
    4
    Views:
    238
Loading...

Share This Page