2015-08-08 104 views
1

当我在移动设备上向下滚动时,我无法将背景图像设置为屏幕居中位置。无法将背景元素设置为固定位置

目前,我在我的桌面上滚动时的网站背景与我想要的一样。问题出在移动设备上,由于某些原因,当使用开发工具查看移动解决方案的网站时,它的效果很好,但实际操作时却无法正常工作。

任何人都可以请帮我解决这个问题吗?

我当前的代码是:

body.custom-background, #custom-background-css { 

    background-position: center center !important; 
    min-height: 100%; 
    background-repeat:no-repeat; 
    background-attachment: fixed; 
} 

我的网站是:test.ebdesigns.us (WordPress的平台)

此外,当收视源代码的东西是生产这个,不知道。这可能会影响它。

<style type="text/css" id="custom-background-css"> 
body.custom-background { background-image: url('http://www.test.ebdesigns.us/wp-content/uploads/2015/07/NewColumbis51Logorev101.jpg'); background-repeat: no-repeat; background-position: top center; background-attachment: fixed; } 
</style> 

回答

0

竟有些插件发送这种“body.custom背景”你的CSS,但这种情况并非如此

更改代码的说>背景位置:“顶部中心”而不是“中心中心”。这将做

**如果你想保留你的中心为中心,以提供一个高度到你的主容器(体)

body.custom-background, #custom-background-css {  
    background-position: center center !important; 
    min-height: 100%; 
    background-repeat:no-repeat; 
    background-attachment: fixed; 
    height:100vh; 
} 

干杯。快乐

+0

不,它只是将图像移动到我的移动设备顶部,只是试了一下。 – LouiIsMyDog

+0

另外,你的意思是“其实一些插件发送这个”body.custom-background“你的CSS,但这不是这种情况”?我有一个插件干扰? – LouiIsMyDog

+0

编辑::增加身体的高度。 (height:100vh) – joyBlanks