Html CSS 定位高于所有元素

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12670716/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:07:32  来源:igfitidea点击:

CSS Positioning Above all elements

htmlcssgraphicsposition

提问by Michael Benneton

So I have a small login box that appears when clicking the login button. The problem is that when it appears, it appears behind everything else on the page. This is what it looks like: Login

所以我有一个小的登录框,当点击登录按钮时会出现。问题是当它出现时,它会出现在页面上的所有其他内容之后。这是它的样子: 登录

How do I make the login box ALWAYS appears above anything on a page?

如何使登录框始终显示在页面上的任何内容上方?

回答by Giona

Some code would be nice... anyway try with z-index:

一些代码会很好......无论如何尝试使用z-index:

#login-box-id {
    z-index:99999;
}

回答by C?????N????

you need to apply some z-indexing,

你需要应用一些z-indexing,

I assume you have a position set to either absolute or relative or fixed, if so, add this too

我假设你有一个位置设置为绝对或相对或固定,如果是这样,也添加这个

z-index:2;

If you want more help please provide some CSS/html and i can show you exactly where it needs to go.

如果您需要更多帮助,请提供一些 CSS/html,我可以准确地向您展示它需要去哪里。