简体   繁体   English

具有z-index的CSS层

[英]CSS Layers with z-index

I have something like this 我有这样的东西

<div id="page"> // z-index:1; position:relative;
   <div>Some Content</div> // z-index:10000: positon: fixed;
</div>
<div id="mask"></div> // z-index:9998; position:absolute;
<img> // z-index:9999; position: fixed;

I want to display "Some Content" over the picture . 我想在图片上显示“某些内容”。

It works if <div id="page"> with z-index:0; 如果<div id="page">的z-index:0;参数有效; and if I change it to z-index:1; 如果我将其更改为z-index:1; I see the picture but my Content is under it. 我看到了图片,但是我的内容在下面。

How can I put my Content over the picture and still have <div id="page"> with z-index:1;? 如何将我的内容放在图片上,并且<div id="page">带有z-index:1 ;?

As an example see this Link: http://entw.yogabox.de/Specials/Yogamatten-2-Wahl/Asana-Yoga-Matte-Sticky-lila-2-Wahl.html 例如,请参见以下链接: http : //entw.yogabox.de/Specials/Yogamatten-2-Wahl/Asana-Yoga-Matte-Sticky-lila-2-Wahl.html

You should click the big green button and then you'll see my white picture without content. 您应该单击绿色的大按钮,然后您会看到没有内容的我的白色图片。

You can not give a child div a higher z-index than its parent. 您不能给子级div更高的z-index父级。 Its Relative to the parent given z-index. 相对于父级给定的z-index。

You need to put the div with the content out of the div with the id="page" to achieve the desired effect. 您需要将带有内容的div放在带有id =“ page”的div之外,以实现所需的效果。

But there is also a quite easier soluten. 但是,还有一个相当容易的溶质。 Use lightbox 2. 使用灯箱2。

http://lokeshdhakar.com/projects/lightbox2/ http://lokeshdhakar.com/projects/lightbox2/

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

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