View Full Version : How to position an image ANYWHERE on a page?

12-03-2010, 11:52 PM
Let me start anew thread for this issue guys. I understand now about "box" positioning, what I'd like to know now is how to position an image anywhere I feel like on a page? For example, I don't want "top right" or "bottom left" e.t.c, I want to be able to place an image anywhere? So let's say I have a header and I want to position an image at an exact spot within that header how can do so?

12-04-2010, 12:26 AM
You’d use absolute positioning on the image. Note that the position of an absolutely positioned element is relative to the bounding box of the next relative, absolute, or fixed positioned parent element. If none applies, then the viewport is the bounding box.

So, if you have a header with an image inside you’d apply position: relative to the header and position: absolute to the image. You can then position it with the left/right/top/bottom CSS properties.

12-04-2010, 09:45 PM
It must looks like this:

div#header {
position: relative;

img#headimg {
position: absolute;
left: whatever you like
top: whatever you like

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum