Saturday, 14 September 2013

Keep background image CENTERED and UNSCALED regardless of browser window size

Keep background image CENTERED and UNSCALED regardless of browser window size

I'm trying to edit the background so it stays centered. However everytime
I resize the window to say a smaller size to test it out, the image shifts
more and more to the left. I tried other codes but they wind up scaling
down the background. If I view my page on another computer, the image is
off center as well. :(
<style>
html, body {
margin: 0px;
background-color: #000000;
background-image: url('http://i.imgur.com/zwbnaPk.jpg');
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
</style>
I'd like it to look centered like this regardless of the window size.
Although it's slightly off in this photo, you get what I mean.
http://i.stack.imgur.com/iN5BR.jpg

No comments:

Post a Comment