开发者

Background image always centered [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜