简体   繁体   English

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

[英]Can't overlay an image over another

I am looking for some help. 我正在寻找帮助。 I have built a site where I want to have a patterned background image (works fine) but, I want to have a border image on top of the background image across the top. 我已经建立了一个网站,希望在该网站上有图案的背景图像(可以正常工作),但是我想在背景图像的顶部有一个边框图像。

I have tried using position: absolute and setting the z-index on each element but each time it cuts the background image in half and doesn't overlay at all. 我试过使用position:absolute,并在每个元素上设置z-index,但是每次它将背景图像切成两半并且完全不重叠时。

Help! 救命!

Here's the code I have so far. 这是我到目前为止的代码。 I am new to coding so excuse any poor code! 我是编码新手,请原谅任何可怜的代码!

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;
}

use multiple backgrounds: 使用多个背景:

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;
}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM