2011-05-09 90 views
0

我有一個模式的背景圖像,正在重複自己的身體標記 圖像是256x256像素。多背景圖像的CSS問題

body { 
    font: 12px/1.4 Helvetica, sans-serif; 
    color: #fff; 
    background-image: url("img/bg1.jpg"); 
    background-repeat:repeat; 
} 

#bg2{ 
    ? 
} 

#wrap{ 
    width:960px; 
    margin:0 auto; 
} 

然後,我得到了第二個圖像,我想固定在重疊身體圖像的屏幕中心。這張圖片是第二個免費圖片,它不需要重複它自己。尺寸:400x800px。

這張第二張圖片看起來和第一張圖片的邊緣相同,但在中間有一些閃電,所以你在海中,我需要某種透明度。

的HTML:

<body> 
     <div id="wrap"> 

     <div id="bg2">..here comes the 2nd bkground image..</div> 

     ....content 
    </div> 
</body> 

問題是,多個bacground圖像不是那麼容易acomplish。有人可以幫忙嗎?

回答

1

嘗試這樣:

#bg2 { 
    position: absolute; 
    height: 100%; 
    width: 100%; 
    background: url('img/bg2.jpg') no-repeat fixed center; 

    /* IE transparency */ 
    filter: alpha(opacity=60); 

    /* standard transparency */ 
    opacity: 0.6; 
} 
+0

PS。我需要補充:position:absolute;上面的例子,並把第二個div背景在中心不推其他div。 – PathOfNeo 2011-05-09 10:31:34