参见英文答案 >
CSS background image on top of
不知道如果这是可能的,怎么样,但是我试着用我的代码中的元素的z-index玩弄没有成功。
我有一个div元素,在css中设置了一个背景图像。在div里面,我有其他元素,像div和img。我试图让包含背景图像的主要div保持在顶部,因为我想要的背景图像显示在其他元素的顶部(这个背景图像有一些圆角,我想显示在图像的顶部在这个div)。
示例HTML:
示例CSS:
/* How can I make the bg image of this div show on top of other elements contained
Is this even possible? */
#mainWrapperDivWithBGImage {
background: url("myImageWithRoundedCorners.jpg") no-repeat scroll 0 0 transparent;
height: 248px;
margin: 0;
overflow: hidden;
padding: 3px 0 0 3px;
width: 996px;
}