0

您好,我在 CSS 中的固定背景有一点问题。我需要把它固定在左下角。

http://i.imgur.com/Y1gKd.jpg

background: url('./images/coura.png') no-repeat fixed;
width: 451px;
height: 736px;
position: fixed;
background-attachment: left bottom;

有什么办法吗?谢谢您的回答!

4

3 回答 3

1

您的元素需要位于您希望背景所在的位置。添加left: 0px; bottom: 0px;到固定定位。

于 2012-06-06T22:13:53.430 回答
0

最简单的解决方案是将图像设置background-image为您的body并将background-attachment属性设置为fixed

html, body { height: 100%; }
body { background: url('./images/coura.png') 0 100% no-repeat fixed; }

http://jsfiddle.net/Wexcode/FEskF/

于 2012-06-06T22:32:45.617 回答
0

另一种方法是将背景位置设置为bottom left

background: url('./images/coura.png') bottom left no-repeat fixed;

于 2012-06-06T22:43:41.147 回答