2012-06-06 92 views
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; 

有什麼辦法怎麼辦呢?謝謝您的回答!

+0

如果屏幕分辨率太小,圖像是否被切斷,您是否在意? – Wex

+0

nope我只關心更大的分辨率。 1366x768 + –

+0

僅供參考,'position'應該是'left bottom','background-attachment'應該'fixed'。 http://www.w3schools.com/cssref/css3_pr_background.asp – Wex

回答

0

另一種方法是後臺位置設置爲bottom left像這樣:

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

+0

適合我。謝謝 –

1

你的元素需要在你想要的背景位置。加上left: 0px; bottom: 0px;去定位。

+0

我需要它在左下角。如果我做了類似margin-top的事情:不管。我有更大的分辨率問題。現場示例 - ** http://www.soutezime.org/pantheon/** –

+0

那麼首先,爲什麼heck是那個「現場示例」的高度'1500px',第二呢我曾經在哪裏討論過'margin -top'? –

+0

因爲如果是更高分辨率的高度:768px您只會看到雙腿。我真的不知道該怎麼做。所以我正在嘗試一切;) –

0

最簡單的解決辦法是設置圖像的background-imagebody並設置background-attachment屬性fixed

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

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

+0

但我需要使用「像按鈕」一樣向下滾動此圖像。所以我認爲它不能在身體背景上。 –