Click to See Complete Forum and Search --> : My div changes position if i change the page resolution!!!


dante00
01-09-2005, 06:04 AM
Dear all
I'm working on a site, where i should show different images of the same project, i decided to put all the images in the same page in different <span> with an absolute position, so by clicking on the number in the left side; the surfer will see in the right box each time a different image.

The problem is when i change resolution or if the page opens in a smaller window; all the divs changes their positions, how can i avoid this?

Please Heeeeelp

JPnyc
01-09-2005, 10:32 AM
I moved this to the CSS forum because it's really not a DHTML issue. The answer should be, don't use absolute positioning, use relative.

vwphillips
01-14-2005, 09:55 AM
first <span> position is not recognised in all browsers so best not to use it for this purpose.

you can set the position by style= in the image tag.

if this is set by default or intention to 'relative' then their position will change as the window size changes.

Place them outside other positioned elements and setting style="position:absolute;top:*whereeveryouwantit*px;left:*whereeveryouwantit*px;" will ensure that their position will be fixed irrespective of the window size.

JPnyc
01-14-2005, 09:58 AM
But that can get you into trouble with other page elements. For example, the img and font sizes. You can set img size to a % but do to that with a font requires JS. You can run into a lotta trouble at different res. using absolute positioning.

vwphillips
04-29-2005, 06:00 PM
each to thier own

but if is to stay in the same position ie 400px from the top and 300px from the left that is absolute positioning!