2017-08-27 125 views
1

我一直在處理這個問題一段時間,試圖自己解決它,但我只是無法縫合才能夠達到它的底部。基本上,我有一個我在身體標籤中使用的背景。但是,只要我的背景圖像被移動設備上的扭曲,像素化添加文本和它實物放大使身體背景響應

這是我用身體背景圖片的CSS代碼:

body { 
    background-image: url(background.png); 
    background-repeat: no-repeat; 
    background-position: center 70px; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

任何幫助將不勝感激。

+0

你可以張貼一些截圖?當然,如果它太小,它會像素化,並且你試圖在整個背景上拉伸它。 –

+0

尋求代碼幫助的問題必須包含在問題本身**中重現它所需的最短代碼**最好在[Stack Snippet](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript- CSS-和HTML的代碼段/)。請參閱如何創建[最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。 – andreas

+0

你好,形象不是太小。這是1900×1200像素..這就是爲什麼我不明白爲什麼它像素化和扭曲... – user8409595

回答

0

通過固定圖像並定位其上的中心位置,圖像將以所有顯示模式爲中心。

html,body{ 
 
height: 100%; 
 
} 
 
body{ 
 
background-image:url(http://www.cutestpaw.com/wp-content/uploads/2016/02/s-Yoshi-The-Seal-Kitteh.jpg); 
 
background-position: center center; 
 
background-repeat: no-repeat; 
 
background-attachment: fixed; 
 
background-size: cover; 
 
}

+0

你好,這工作,一切現在看起來很棒!非常感謝你的幫助! – user8409595