Forum Moderators: not2easy

Message Too Old, No Replies

div id moves to right when change page resolution

         

norm

3:29 am on Aug 1, 2009 (gmt 0)

10+ Year Member



I was reared with table and find the transition to CSS difficult. I have set up a page with the resolution of 1024*768 with everything looking good in a browser. However when I change the resolution to 800*600 a div 2 I have placed in main, using draw AP Div, moves to the right in the browser. The Div 2 moves to the left when I increase the resolution. I would appreciate any help on this. This is the code:
#apDiv2 {
position:absolute;
left:384px;
top:491px;
width:212px;
height:205px;
background-color:#999;
layer-background-color:#999;
border:1px none #000000;
z-index:1;
}

<body>

<div id="apDiv2">Hi everyone</div>

swa66

11:04 pm on Aug 1, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Position absolute references something to place itself. That something is the closest parent that has gained "position" or the viewport if no such parent exists.

Gaining position can be done by setting position to absolute or relative (not to static, the default).

So the first thing to look for is what is reference for the element.

Also I'd suggest to validate your CSS and HTML. E.g. "layer-background-color" is not going to be recognized AFAIK.