我的z-index属性没有设置 [英] My z-index property is not getting set

查看:145
本文介绍了我的z-index属性没有设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,其中包含登录和联系人模块,该模块从页面的左上角滑出。我只有一个问题:登录模块工作正常,但联系人模块正在文本下面,而不是上面。我设置 z-index:999999; 但是,它仍然不工作。我使用 position:fixed;

I have a site with a log-in and a contact module, which is sliding out from the top-left side of the page. I have only one problem: the log-in module is working fine, but the contact module is going underneath the text, rather than above it. I set z-index: 999999; but, it still isn't working. I'm using position: fixed;

推荐答案

移动#iUngicontactForm表到body标签会修复它。
问题是元素的z-index是从它的父继承的,它只适用于兄弟元素。

Moving #iUngicontactForm from the table to the body tag will fix it. The problem is that the z-index of an element is inherited from it's parent and it only applies to sibling elements. And as you're using fixed positioning, it's a quick fix.

而不是像这样:

<body>
   <table>
     <tr><td>some content..</td></tr>
     <tr><td><div id="iUngicontactForm"></div></td></tr>
    </table>
</body>

执行此操作:

<body>
   <div id="iUngicontactForm"></div>
   <table>
     <tr><td>some content..</td></tr>
    </table>
</body>

这篇关于我的z-index属性没有设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆