2013-04-03 190 views
-1

我想給我的身體一個固定在中間的背景。身體背景CSS固定

因此,當我縮小窗口時,它不會開始切割右側並保持左側靜止。我希望它在同一時間左右切割。

我希望它是這樣的例子:www.everythingisnew.pt

在該網站,你可以清楚地看到,背景被從兩側同時「吃」的窗口。

背後是什麼css?

回答

1

指定background-position: centerbody元素的CSS:

body { 
    background: url('your/background/src.png') no-repeat fixed center 
} 
+0

的感謝!完全做到了! – user2241087

0

這可能會解決你的問題

background-image: url(src.jpg); 
background-repeat: no-repeat; 
background-position: fixed center; 
background-size: cover;