如何固定 wordpress的网站背景图片,就是滑动屏幕时,网站的背景图片不变。

2025-02-24 21:34:20
推荐回答(3个)
回答1:

body
  { 
  background: #00FF00 url(bgimage.gif) no-repeat fixed top;
  }

fixed 就可以起到效果

回答2:

body {
background-image:url('这里填写图片地址');
background-repeat: no-repeat;
background-attachment: fixed;
}

回答3:

在CSS文件中添加:
body{
  background-image:url("URL");
  background-position:100% 0%;
  background-repeat :no-repeat;
  background-attachment:fixed;
}
url位置写你的背景图片位置,可以是绝对地址也可以是相对地址。
position是定义位置,可以写具体位置,也可以使用left.right或者center或左右中。
repeat是重复方式,可以不重复,或者垂直重复、水平重复或者全部重复。
background-attachment:fixed;是用来固定图片不随鼠标滚动。