开发者

How can I set a background image to the entire page of my site?

开发者 https://www.devze.com 2023-02-07 05:57 出处:网络
http://jsfiddle.net/stapia开发者_运维技巧gutierrez/hfhfp/ For example, I\'d like the user to scroll down, but the image to not move.

http://jsfiddle.net/stapia开发者_运维技巧gutierrez/hfhfp/

For example, I'd like the user to scroll down, but the image to not move.

Any suggestions to my CSS?

Similar to http://www.mobafire.com/ where the picture is set, but the scrolling doesn't move it.


You need to assign backgroun-attachment property to fixed for body element. i.e:

body{
    background: url('http://i.stack.imgur.com/6C5Ym.jpg');
    background-repeat:no-repeat;
    background-attachment:fixed;
}

Check jsFiddle@: http://jsfiddle.net/hfhfp/2/


Add fixed to the background properties like so :

body{
  background: url('http://i.stack.imgur.com/6C5Ym.jpg') fixed no-repeat;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消