PDA

View Full Version : DIV position permanent, please help.



Immortal
09-30-2008, 10:26 AM
Hey guys,

I have a question about a DIV;


<div id="apDiv3"><img src="Images/Logo.png" width="248" height="248" alt="** PLEASE DESCRIBE THIS IMAGE **" /></div>

You can see it on this page:

http://www.chemicaldesigns.org/ClientArea/_clients/InclusionThroughAngling/markup.html

I want to position the DIV to basically stay in the same place on the page. I am guessing it's quite easy to do but need some help from someone who knows the score.

Thanks a lot!

TheJoshMan
09-30-2008, 11:49 AM
use position: fixed;

Immortal
09-30-2008, 02:16 PM
Hi, I tried that but then it just stays in the same place but as soon as the browser resizes the logo moves. I want it to stay in the same place even if the browser is resized, would you know how I do this?

Thanks.

traq
09-30-2008, 03:15 PM
do you mean that you want it to stay a certain distance from the top left? You're using a percentage to define it's position now:

#apDiv3 {
position:absolute;
width:130px;
height:115px;
z-index:99;
left: 5%;
top: 6%;
}
Use pixel measurements and change the position to "fixed", something like this:

#apDiv3 {
position:fixed;
left:30px;
top:36px;
}

Immortal
09-30-2008, 07:33 PM
Hey, thanks for the help, but basically that does the same thing as percentage. I want it to stay in the same place because of different screen resolutions, is there a way I can position it from the center rather than the top left?

Thanks,

traq
09-30-2008, 11:30 PM
It's not the same as a percentage: for example, 5% left on a 800x600 screen is 40 pixels from the left, but on a 1440x900 screen, it's 72.

I think what I don't understand is what you mean by "the same place". Do you want it to always be a certain distance from the center column (where your main content is)?