2015-08-08 82 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