你好,我有一個固定的CSS背景有點問題。我需要將它修復到左側角落。背景位置:固定
background: url('./images/coura.png') no-repeat fixed;
width: 451px;
height: 736px;
position: fixed;
background-attachment: left bottom;
有什麼辦法怎麼辦呢?謝謝您的回答!
你好,我有一個固定的CSS背景有點問題。我需要將它修復到左側角落。背景位置:固定
background: url('./images/coura.png') no-repeat fixed;
width: 451px;
height: 736px;
position: fixed;
background-attachment: left bottom;
有什麼辦法怎麼辦呢?謝謝您的回答!
另一種方法是後臺位置設置爲bottom left
像這樣:
background: url('./images/coura.png') bottom left no-repeat fixed;
適合我。謝謝 –
你的元素需要在你想要的背景位置。加上left: 0px; bottom: 0px;
去定位。
我需要它在左下角。如果我做了類似margin-top的事情:不管。我有更大的分辨率問題。現場示例 - ** http://www.soutezime.org/pantheon/** –
那麼首先,爲什麼heck是那個「現場示例」的高度'1500px',第二呢我曾經在哪裏討論過'margin -top'? –
因爲如果是更高分辨率的高度:768px您只會看到雙腿。我真的不知道該怎麼做。所以我正在嘗試一切;) –
最簡單的解決辦法是設置圖像的background-image
您body
並設置background-attachment
屬性fixed
:
html, body { height: 100%; }
body { background: url('./images/coura.png') 0 100% no-repeat fixed; }
但我需要使用「像按鈕」一樣向下滾動此圖像。所以我認爲它不能在身體背景上。 –
如果屏幕分辨率太小,圖像是否被切斷,您是否在意? – Wex
nope我只關心更大的分辨率。 1366x768 + –
僅供參考,'position'應該是'left bottom','background-attachment'應該'fixed'。 http://www.w3schools.com/cssref/css3_pr_background.asp – Wex