Page 1 of 1
Postion: Relative - why is it knocking everything else out?
Posted: Mon Oct 22, 2012 7:33 am
by simonmlewis
Code: Select all
.img_ghost
{
position:relative;
right:-260px;
top: -30px;
height: 156px;
}
I'm trying to position an image over the top of another one, so the tip of it's head is outside the background DIV.
I can do this. But what I cannot do, is stop it forcing the text (and text/image) on the left above the ghost, or below the ghost.
Is there a CSS 'position' that does this without causing this problem?
Re: Postion: Relative - why is it knocking everything else
Posted: Mon Oct 22, 2012 11:55 am
by Celauran
You want absolute positioning here.
Re: Postion: Relative - why is it knocking everything else
Posted: Mon Oct 22, 2012 12:07 pm
by simonmlewis
How? I tried that and it went even worse!
Re: Postion: Relative - why is it knocking everything else
Posted: Tue Oct 23, 2012 4:00 pm
by Celauran
Relative positioning on the parent, absolute on the child.
Code: Select all
<div id="parent">
<img class="img_ghost" src="whatever" />
</div>
Code: Select all
#parent { position: relative; }
.img_ghost {
position: absolute;
top: 3px;
left: 3px;
}
Re: Postion: Relative - why is it knocking everything else
Posted: Tue Oct 23, 2012 4:05 pm
by simonmlewis
What stops the parent DIV taking up the width of the outter div, and still pushing the text down below it?