Background image always centered [closed]
I have created a website but am having an issue forcing the background image to always be center. It looks great when the site is maximized but when I make the window resolution smaller the background gets pushed to the left and the content overflows to the right. It would be solved if I could just force the background image to just be centered all the time no matter what the window size. My CSS to center the image looks as follows
body { background: #EDEDED url(../images/bg-y.png) repeat-y scr开发者_开发技巧oll 50% 0;
font-size:12px;
font-family:'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Arial, san-serif;
color:#000000; }
I have a live example which can be seen at http://www.theprizeshark.com/
To get the error I am talking about minimize the window so you have to scroll to the right and you will see that the content all overflows the background image. Thanks.
I think all you need to do is change the percentage 50%
to center
w3schools site is full of usefull information.
http://www.w3schools.com/css/pr_background-position.asp
body{
background: #EDEDED url(../images/bg-y.png) repeat-y scroll center top;
font-size:12px;
font-family:'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Arial, san-serif;
color:#000000;
}
精彩评论