...

View Full Version : Keeping an element in a fixed position, within another div



eberdome
02-16-2011, 10:31 PM
Hello,

I am trying to keep and element in a fixed position while it sits in a div that has a position of relative and is sitting center at 964px. The left burgundy panel is what I'm trying to have sit in the position its already in, but fixed. Does anyone know how i can achieve this.

div#lp sits within div#inner, although a fixed position takes it out of div#inner

Link

http://experiencemediaonline.gorillaonemedia.com/work/

quartzy
02-16-2011, 11:58 PM
Looks fine to me in FF

eberdome
02-17-2011, 12:43 AM
well this is because I still have the position set to absolute. when i change it to fixed it jumps out of the div and sits against the left wall of the browser

eberdome
02-17-2011, 08:05 PM
this is what I am trying to achieve, see how the panel is fixed, but yer in the middle of the screen. How do i get my burgundy panel to do the same??

Link I'm trying to achieve: http://btemplates.com/2010/blogger-template-oulipo/demo/

My link: http://experiencemediaonline.gorillaonemedia.com/

teedoff
02-17-2011, 08:14 PM
Did you try this? One thing to mention though. You wont see much fixed position on that div when your page content is so short. If you have some pages that will increase in height(content) then you will see the effects.


div#lp {
background: none repeat scroll 0 0 #2C0203;
height: 390px;
/* left: 0;*/
/* margin: 0;*/
margin-top: 131px;
padding: 0;
position: fixed;
width: 180px;

You said when you changed position to fixed it "jumped" out and nestled up against the left wall. Thats because you have a margin and left position of 0 in the style. You can see I commented out that margin and the left: 0; as well.

eberdome
02-17-2011, 08:22 PM
teedoff,

That worked splendid! Thank you so much!!

teedoff
02-17-2011, 08:26 PM
teedoff,

That worked splendid! Thank you so much!!

You're welcome. Actually, you could float that div left and instead of top:131px; change it to

margin-top: 131px;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum