在CSS中,我試圖找出如何單獨控制堆疊在一起的兩個背景圖像的大小。所以在CSS中,可以定義1個背景圖像:background:url('base.png') no-repeat center;
。爲了在基本圖像的頂部堆疊覆蓋圖,可以使用如在圖1的中的方法。如何控制單個背景定義的多個圖像
.my-class { background: url('overlay.png') no-repeat center, url('base.png') no-repeat center; background-size: 100% 100%; }
圖1
不過,如果我想爲每個圖像的尺寸略有不同,我不知道該怎麼做。我想象的咒語是一種內嵌位置和尺寸的定義,如在圖2。但我還沒有完全正確。有誰知道如何做到這一點?提前致謝。
.my-class { background: url('overlay.png') no-repeat 0 0/100% 90%, url('base.png') no-repeat center 0 0/100% 100%; }
圖2
看看http://stackoverflow.com/questions/423172/can-i-have-multiple-background-images-using-css我假設你可以調整大小,如下所述由grapien – Mal 2013-03-27 05:23:53