2017-09-12 125 views
-1

所以我的工作在http://development.randomrab.com背景沒有開始頂

託管的網站上的背景頂部開始了,每當我有後臺連接設置爲固定。不過,我希望背景可以滾動。每當我將背景附件設置爲滾動時,背景圖片都從頁面中心開始。如在,你必須向下滾動才能看到背景。我嘗試將背景位置更改爲頂部,中心頂部,頂部中心,但沒有任何工作。

我的CSS代碼如下所示:

body { 
color: #FFF; 
font-size: 14px; 
font-family: Arial, Tahoma, Verdana; 
margin: 0 auto 0; 
padding: 0; 
line-height: 24px; 
background-color: #0C0807; 
background-attachment: scroll; 
background-image: url(images/Rab_bg.png); 
background-repeat: no-repeat; 
background-position: top; 
} 
+0

你'背景position'被設置爲'center'該網頁上。我把它改成了'top',它工作正常。 – Aydin4ik

+0

你需要在這裏發佈一個完整的,最小的問題的例子,而不是你的網站:[mcve] – Rob

+0

@Rob我提供了我的網站,但我也展示了我的代碼。 –

回答

0

background-attachment: scroll相同background-attachment: initialmore info)。如果您重置背景附件和位置,則會將背景圖像重置爲頂部。然後你可以稍後根據自己的喜好操縱它。

background-attachment: initial; 
background-position: center top; 

這你會得到什麼: 在Chrome中: Randomrab Chrome Screenshot

在Firefox: Randomrab Firefox Screenshot

+0

它仍然看起來有點關閉。 –

+0

它看起來像將它左移或右移。我需要它在頂部和居中。 –

+0

用'background-position:top center'編輯 – Aydin4ik