dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: <DIV> layer TO <td> position?

  1. #1
    Join Date
    Nov 2002
    Posts
    3

    <DIV> layer TO <td> position?

    I have a problem... I want to use the <DIV> tag so I can toggle visibility on/off, so I've put all the <DIV> tags inside a <TD>. I know that's not proper HTML, but I want them to display IN or ON TOP OF that TD, since the layers are supposed to show up at the bottom of those cells. Naturally, as you experienced users know, putting all the <DIV> layers in there makes them jump around. They won't behave and seem to do random things.

    HOW can I tack a <DIV>'s position to a TD? Or an image? Or something? I want it to always show up at the bottom...

    Thanks!

    C5

  2. #2
    Join Date
    Nov 2002
    Posts
    984

    Re: <DIV> layer TO <td> position?

    Originally posted by catsfive
    HOW can I tack a <DIV>'s position to a TD? Or an image? Or something? I want it to always show up at the bottom...
    If you are abusing <table> for layout it's going to be tricky, but otherwise it's easy.

    You simply position an entity and every child of it will be positioned relative it.

    Eg

    <div style="position:relative; top:0; left:0;">

    <div style="position:absolute; top:10px; left:10px;"></div>

    <div style="position:absolute; top:10px; left:10px;"></div>

    <div style="position:absolute; top:10px; left:10px;"></div>

    </div>

    The 3 divs nested in the original div will all be placed with their top left corner 10px down and to the right of the parent.

  3. #3
    Join Date
    Nov 2002
    Posts
    3
    Oh, Stefan, this is a good idea, I didn't think of this.

    However, OK, cool... how do I handle the position of the first layer? I want that layer to always be at the bottom of a table whose row count is always changing...

    MC5

  4. #4
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by catsfive
    However, OK, cool... how do I handle the position of the first layer? I want that layer to always be at the bottom of a table whose row count is always changing...
    Did you actually try the code?

    <div style="position:relative; top:0; left:0;">

    It should do exactly what you ask for, but might mess up eg dynamic column width calculations.

  5. #5
    Join Date
    Nov 2002
    Posts
    3
    No, I didn't try the code yet, because I already know it's not quite what I need. I need the DIV to be aligned to the <TD> it's in, and not at a certain position. The TD is always shifting around based on what data rows are there, so sometimes it could be lower, higher, etc.

    I have seen a script that sort of does this-- it tacks a DIV to a TD cell but it works onMouseOver using the TD's like buttons, which I don't want. I want the page to put each DIV in a certain position (dictated by the position of that TD)... I hope this makes sense, and thanks for your input.

    M

  6. #6
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by catsfive
    I need the DIV to be aligned to the <TD> it's in, and not at a certain position. The TD is always shifting around based on what data rows are there, so sometimes it could be lower, higher, etc.
    Sigh...
    Get back to me after you have tried the code.

  7. #7
    Join Date
    Nov 2002
    Posts
    4,473

    Re: <DIV> layer TO <td> position?

    Originally posted by catsfive
    I want to use the <DIV> tag so I can toggle visibility on/off, so I've put all the <DIV> tags inside a <TD>.
    Why do you need a <DIV> in the first place? Why don't you control the visibility of the <TD>?

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