Absolute positioning, but do not move with different screen resolutions

Discussion in 'CSS' started by puffyz, Jul 10, 2008.

  1. #1
    Hi, having a problem getting a div to stay in a exact same place. What I was to do is put the css code at bottom, but make the div float and stay in exact position no matter the screen size. I can't seem to get it as when screen width goes down, the image moves to the left as well. Is there anyway to make it stay put no matter what? thanks.

    here is what ive tried:
    <div align="right" style="position: absolute; top: 41px; right: 130px;"> <a href="http://www.domain.com" target="_new"><img src="http://www.domain.com/pbt.png" width="134" height="16"/></a></div>

    thanks.
     
    puffyz, Jul 10, 2008 IP
  2. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Put it in a table and then the div will reposition from the table. But no matter what browser the table will be in the same spot so div will be forced to stay in the same spot on the table.
     
    rebelagent, Jul 10, 2008 IP
  3. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #3
    We need to see the rest of the code. Those coordinates you've set for the absolutely positioned box is RELATIVE to its nearest positioned parent. We cannot see who this parent is, what his sizes are, where he is on the page, so we cannot help you there. Post more code, or a screenshot showing what he's doing.

    There is also another option you could try, except in IE6: position: fixed. This means it stays in place just like if you had the div in a post-it note taped to the monitor.

    There is no point in floating something, and then also trying absolute positioning. You must pick one.

    *edit:
    You have stated its position from the right of it's positioned parent (or the body, if there isn't a positioned parent) and that right side is ALSO moving to the left as you shrink your browser (thus, the reason your div moves). If you want this image to get cut off as the browser width shrinks, you may want to try setting the position from the LEFT side.
     
    Stomme poes, Jul 11, 2008 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Dude, don't hijack the thread.
     
    Stomme poes, Jul 11, 2008 IP
  5. puffyz

    puffyz Guest

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    so fixed would work just not in ie 6?

    basically the page is a bunch of divs ....
     
    puffyz, Jul 11, 2008 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    IE6 doesn't understand position: fixed. It does understand position: absolute, which can look really similar... but it scrolls. Fixed does not scroll with the page. It might not be what you're looking for.

    Did you try setting your position from the left instead of the right?
     
    Stomme poes, Jul 12, 2008 IP