2015-09-05 122 views
0

我發現下面的CSS在桌面環境下按預期工作,但在iOS移動環境中,圖像不會在後臺加載。在iOS(Chrome和Safari)中無法正常工作的CSS背景URL

我聽說修復在iOS環境下可能不可行,但我也測試過滾動 - 以及多個圖像大小。

在此先感謝

.intro { 
    display: table; 
    width: 100%; 
    height: 100%; 
    padding: 100px 0; 
    text-align: center; 
    background-color: #fff; 
    background: url(http://ak-hdl.buzzfed.com/static/enhanced/web03/2011/11/11/16/enhanced-buzz-22138-48705-11.jpg); 
    background-position: center; 
    background-attachment: fixed; 
    background-repeat: no-repeat; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    background-size: cover; 
    -o-background-size: cover; 
} 
+0

嘗試改變'background'成'背景image'。 –

+0

不,沒有做到!抱歉 –

回答

1

有幾個問題:

  1. 修正了不支持所有的移動瀏覽器和通話背景圖像加載失敗。
  2. 我發現(與caniuse.com相反)背景速記在所有瀏覽器中都不起作用。

工作代碼:

.intro { 
display: table; 
width: 100%; 
height: 100%; 
padding: 100px 0; 
text-align: center; 
background-color: #fff; 
background-image: url(http://ak-hdl.buzzfed.com/static/enhanced/web03/2011/11/11/16/enhanced-buzz-22138-48705-11.jpg); 
background-position: center; 
background-attachment: scroll; 
background-repeat: no-repeat; 
-webkit-background-size: cover; 
-moz-background-size: cover; 
background-size: cover; 
-o-background-size: cover; 
} 
相關問題