根據QuirksMode,定義多個背景(至少)在IE9,Chrome和Firefox 3.6中起作用。
我有以下的CSS:CSS3多重背景?
background: #190110 url("http://static.pokefarm.org/_img/gradients/dark_sky.png") repeat-x fixed left top;
background: url("http://static.pokefarm.org/_img/gradients/dark_edge.png") no-repeat fixed -16px bottom, url("http://static.pokefarm.org/_img/gradients/dark_edge.png") no-repeat fixed right -16px bottom, url("http://static.pokefarm.org/_img/gradients/dark_ground1.png") repeat-x fixed left bottom, url("http://static.pokefarm.org/_img/gradients/dark_ground2.png") repeat-x fixed left 50px bottom 50px, url("http://static.pokefarm.org/_img/gradients/dark_ground3.png") repeat-x fixed left bottom 200px, url("http://static.pokefarm.org/_img/gradients/dark_lightning.png") no-repeat fixed right -100px top -150px, #190110 url("http://static.pokefarm.org/_img/gradients/dark_sky.png") repeat-x fixed left top;
這是一個相當複雜的背景,但它使我的網遊「暗世界」的背景效果。實際上,它有三個不同的「地面」層,一個漸變的天空,兩個「邊緣」可以讓屏幕兩側的地面漸漸消失,還有閃電。舊版瀏覽器應該只能看到「黑暗的天空」漸變背景。
由此產生的效果應該是:Screenshot。
現在來解決這個問題:IE9完美地顯示了這個效果,甚至可以做可選的「動畫背景」效果,其中地面層以視差方式滾動,並且閃電閃爍和CSS變形扭曲。但是,Firefox 6和Chrome 13僅顯示後備漸變背景。
有沒有人有任何想法,爲什麼會發生這種情況?
定義它看上去就像一個鉻錯誤或不落實scenarion,雖然這是[CSS3文件]上(HTTP ://www.w3.org/TR/css3-background/#background-position),即使我們在一個單獨的屬性中輸入了'background-position',它也會失敗。一種避免完全失敗的方法是從速記中提取所有的「background-position」部分,並將它們放在它們自己的屬性上,然後只有'background-property'會失敗,而不是整個背景。 – Luizgrs
我寧願有「備份」漸變 - 只有如何,比缺乏定位打破的背景。 –