html5 移动端怎么固定背景图片?

2025-05-21 05:50:58
推荐回答(3个)
回答(1):

.body{

background:url(../image/pr_gb.png);//此处为你的图片

background-repeat:no-repeat; 

background-size:100% 100%;

}

回答(2):

首页要铺满背景:
background-size: auto(原始图片大小) || number(数值) || percentage(百分比) || cover(放大铺满) || contain(缩小铺满)
其实固定背景:
background-attachment: fixed;

回答(3):

在需要加背景的标签加入以下CSS:
background-attachment:fixed;
背景图片就会固定。
比如: