2015-10-17 105 views
1

我嘗試了很多東西......我無法將網站擴展到移動瀏覽器。在移動瀏覽器中無法縮放的背景圖片

body{ 
    background: url("Photo-Carpentry-Tools-Wood-Planks-Collage-21.jpg") no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: 100% 100%; 
    margin: 0; 
    background-attachment: fixed; 
    max-width: 100%; 
} 

此外,我已經試過

<meta name="viewport" content="user-scalable = yes"> 

和上面代碼的一些其他變化。

該網站實際上是現場直播 - 它是www.readyshift.net - 在Chrome中正常工作,在手機中無法正常工作。

回答

1

我已經採取了看看你fiddle,發現你在它曾經background-size:100%html, body選擇,看到這個後,我訪問了您的live website,看到你用它那裏。

如果您在html, body選擇改變background-size:100%,背景圖像縮放到正常移動網站(通過改變通過開發者控制檯的價值在你live website測試)。

TL:DR要更改的html, body到:

html,body { 
    background: url("http://www.readyshift.net/css/Photo-Carpentry-Tools-Wood-Planks-Collage-21.jpg") no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    margin: 0; 
    background-attachment: fixed; 
    max-width: 100%; 
} 
+0

不是應該'<元名稱= 「視口」 內容=「寬度=設備寬度,初始規模= 1,用戶-scaleable =「yes」>'?但是由於他希望用戶能夠縮放,因此用戶可以只寫''可伸縮是「是」的標準。如果你想了解更多信息,這裏有一個有用的[鏈接](https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag)。 –

+0

@ZiggyVerstrepen - 你說得對,我一定忘記了','或其他,謝謝你讓我知道! – Simplicity

+0

@ZiggyVerstrepen我試過了,它仍然沒有工作。當我這樣做時,我的導航欄變得雜亂無章,圖片佔據了更多頁面,但仍然不是全部。 – Josh