i was wondering how to have always centered a wide image on my screen.
i mean basically web users have a screen resolution 1024x768 (at least…).
if i have a div horizontally centered, in which i have all my website texts, and i have a wide image e.g. 2000x500, how to make this image always center with my main text div ?
it’s to say if web user have a screen resolution 1280x1024 my text and my image seem to be still centered together but user see more of my image on both side.
… and to confirm what Ralph said imagine what would happen if you placed the image at background-position:100% 100%;? If it didn’t relate to 100% of the image then the image would be placed outside of the container it sits in and be invisible.
The percentage in the background-position is not the same as position:absolute; left:100% where the left edge is placed a 100%.
A 2000x500 image won’t even fit in that container, but if you want an image centered within a container, then simply having the container have text-align:center set, and <img> inside the container will center it :).
I wasn’t really able to understand anything else other then you want an image centered (my brain refuses to function right now :()
To center something using CSS you set the left and right marigins to auto.
I would say set your image as a background in a div. Wrap the new background div around the contents div
<div id='background'>
<div id="content">
text
</div>
</div>