我有一個網站,在我的一個網頁中,我使用了一個看起來像編輯器的div。我可以在這個div和上面的內容中有一個背景。當我在div中滾動時,我希望此背景保持固定位置。如何在div中修復背景?
我的代碼是與此類似:
<div id="myEditorArea" style="vertical-align: top; width: 240px; height: 320px; background-image: url('image.png'); background-repeat: no-repeat; background-position: center center; background-attachment:fixed; overflow:scroll; text-align: left;">
bla bla bla
</div>
背景保持固定的,當我滾動DIV中工作正常。問題在於,當我在整個頁面中滾動時,它正在移動。
有誰知道可能是什麼問題?
預先感謝
您可以鏈接到頁面,我不知道我理解這個問題。 –
你忘了結束'style =「...」'。你寫了'style =「...' – kongr45gpen
這個頁面有點複雜,我有一個例子,我發現這個鏈接http://www.quackit.com/html/codes/html_background_codes.cfm和我想要做同樣的事情,就像他爲固定背景圖像做的一樣。我的問題是,當我滾動整個頁面而不是隻在這個div內時,這個圖像正在移動。 – novellino