![](/img/trans.png)
[英]How can I set my pages background image to the referring page's background image
[英]How can I set a background image to the entire page of my site?
http://jsfiddle.net/stapiagutierrez/hfhfp/
例如,我希望用戶向下滾動,但圖像不移動。
對我的CSS有什么建議嗎?
與設置圖片的http://www.mobafire.com/類似,但滾動不會移動圖片。
您需要將body元素的backgroun-attachment屬性分配為fixed。 即:
body{
background: url('http://i.stack.imgur.com/6C5Ym.jpg');
background-repeat:no-repeat;
background-attachment:fixed;
}
檢查jsFiddle @: http : //jsfiddle.net/hfhfp/2/
將固定值添加到背景屬性中,如下所示:
body{
background: url('http://i.stack.imgur.com/6C5Ym.jpg') fixed no-repeat;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.