Question : abs or relative img

want to place an img
at the same height and the same distance from the center

I want it to be
15 from center
and
800 from top




this will move when i resize browser
<div style="position: absolute; left: 610px; top: 800px; height: 400px; width: 100px; padding: 1em;"><img src="paymentmethods.gif" border="1"></div>


this destroys the formating of the page
<div style="position: absolute; left: 610px; top: 800px; height: 400px; width: 100px; padding: 1em;"><img src="paymentmethods.gif" border="1"></div>

Answer : abs or relative img

It would be good, if you could give a bit more information.
I understood, the image shall still be 800 pixels down from top and 15 pixels off from the center.
Do you want to let the text flow around the image?
I think this will make it difficult with a <div> tag. Especially if we consider a changing browser and, lets say a not fixed area of text, then at a certain point you will have the image move to the left border, or to stay where it is and "vanish" from the view when the browser gets too narrow.

As well you have taken positions and a sqare inside the div - I'd more likely provide the size values in the image and let only the position be part of the style.

If you want to have it flexible you either "center" it, or you have to calculate how much it is from the bottom or the top and/or the left / right border. This could as well be done in percentages, if that helps.
Random Solutions  
 
programming4us programming4us