2 replies [Last post]
grayFalcon
Offline
newbie
Last seen: 13 years 46 weeks ago
Joined: 2007-01-17
Posts: 2
Points: 0

Hello everybody!

I seem to remember something like this being possible... I have an image, and I want to position another image on this image, at a specific position. If I do "position: absolute", it's positioned absolutely on the whole page. Is there a way to do something like absolute positioning, but not on the whole page, but just inside another div?

Thanks a lot in advance everybody!

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 37 weeks 23 hours ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Yes, and you can now learn

Yes, and you can now learn about where the AP element takes the position from.

AP elements by default will take their 0,0 coordinates from the body element - that it, the top-left corner of a page.

You need to set the parent of the AP element to relative positioning - something like this:

this paragraph will be at the bottom right of the pink div

#element1 { background: pink; width: 400px; position: relative; }

#element2 {
position: absolute;
bottom: 0;
right: 0;
}

Verschwindende wrote:
  • CSS doesn't make pies

grayFalcon
Offline
newbie
Last seen: 13 years 46 weeks ago
Joined: 2007-01-17
Posts: 2
Points: 0

Thanks, you're my hero!

Thanks, you're my hero! Works like a charm Smile