PDA

View Full Version : Image floating? - HTML/CSS



NewBee2009
Sep 25th, 2009, 06:23 PM
Hello,

I positioned an image where it needs to be. and everything looked good.
But when I was looking at it on a different computer with a different size screen, the image is way over to the right. I went back to the computer that I originally worked on it and it's fine. I clicked and dragged my window a bit smaller to get to get to the desktop and noticed that the page moves with the adjustment of the window, but the image doesn't move with it. It's
like it's floating in the page, but not attached to it. What could be the issue?

Here's HTML code:


<div id="center_col2">
<img src="images/paintbrush.gif" alt="paintbrush" width="335"/>
</div>


Here is CSS code:

#center_col2{
float:left; width:210px;position:absolute; left:670px; top:305px;
}

Any help is appreciated.

Thanks.

jondouglas
Sep 25th, 2009, 06:47 PM
I think you need to position it relative rather then absolute.

NewBee2009
Sep 25th, 2009, 06:53 PM
Thanks, but I originally had it that way and the image doesn't show up.

jondouglas
Sep 25th, 2009, 07:17 PM
Ok, do you have a link to the page?

Scriptet
Sep 25th, 2009, 07:38 PM
Hello,

I positioned an image where it needs to be. and everything looked good.
But when I was looking at it on a different computer with a different size screen, the image is way over to the right. I went back to the computer that I originally worked on it and it's fine. I clicked and dragged my window a bit smaller to get to get to the desktop and noticed that the page moves with the adjustment of the window, but the image doesn't move with it. It's
like it's floating in the page, but not attached to it. What could be the issue?

Here's HTML code:


<div id="center_col2">
<img src="images/paintbrush.gif" alt="paintbrush" width="335"/>
</div>


Here is CSS code:

#center_col2{
float:left; width:210px;position:absolute; left:670px; top:305px;
}

Any help is appreciated.

Thanks.

If you are positioning it absolutley, this means the center_col2 will always be appearing 670px from the left and 305px from the top of any monitor screen. Just as a reminder.

Also if you are positioning it like this, then there's no real need to add float:left to it as you have done, seems rather redudant.

Lastly you've made the center_col2 210px wide, yet the image inside it is 335px wide? Seems a bit contradicting.

NewBee2009
Sep 25th, 2009, 08:39 PM
Thanks for the reply, reminder, and help to everyone. It's all taken care of.
:thumbsup: