无法将图像叠加在另一个图像上

时间:2014-02-12 18:04:51

标签: html css

我正在寻求帮助。我已经建立了一个网站,我希望有一个带图案的背景图像(工作正常),但是,我希望在顶部的背景图像上有一个边框图像。

我尝试过使用position:absolute并在每个元素上设置z-index,但每次将背景图像切成两半并且根本不重叠。

帮助!

这是我到目前为止的代码。我是编码的新手,所以请原谅任何可怜的代码!

body {
color:#787371;
background:url(images/line-top.png) repeat-x top;
position: absolute; 
z-index: 1;
}

#bodychild {
background:url(images/bg-body.jpg);
border:0;
position: absolute;
z-index: 10;
}

1 个答案:

答案 0 :(得分:1)

使用多个背景:

body {
background: 
url(http://subtlepatterns.com/patterns/dark_fish_skin.png) center top repeat-x,
url(http://subtlepatterns.com/patterns/food.png) center top repeat;
}

更多信息:http://css-tricks.com/stacking-order-of-multiple-backgrounds/

相关问题