2013-05-21 64 views
0

我在我的网站上有一个图像(background.jpg)。在桌面上显示正常,但在移动设备上看起来不正确。我想在我的stylesheet.css中更改什么,以使图像缩小到与桌面类似?在移动设备上的CSS背景位置

当前代码:

#services-top-desktop { 
    background: #fff url(../img/background.jpg) fixed no-repeat center; 
    background-size: cover; 
} 

#services-top-mobile { 
    background: #fff url(../img/background.jpg) no-repeat center; 
} 
+0

你可以尝试bgStretcher: http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html – prograhammer

+0

使用两个在这里,我想我在问什么需要改变到移动类... – ThePlague

回答

1

你的代码使用了两个类,一个用于台式机和其它移动。取而代之的是,使用一个通用类的身体在你的CSS

body { 

    background-image: url('../img/test.jpg'); 
    background-repeat: no-repeat; 
    background-size: cover; 

} 
+0

嘿,谢谢,我需要两个类,以便该网站显然适应网页与手机浏览器... – ThePlague