CSS - 最大 z-index 值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8565821/
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-30 02:26:14  来源:igfitidea点击:

CSS - max z-index value

cssbrowsercross-browserz-index

提问by Web_Designer

Is there a maximum / minimum possible value for the CSS z-indexproperty?
Do different browsers have different maximum / minimum accepted values?
How will browsers handle a high / low value?

CSSz-index属性是否有最大/最小可能值?
不同的浏览器有不同的最大/最小接受值吗?
浏览器将如何处理高/低值?

I thought I read somewhere once about a max z-indexvalue. Maybe I'm wrong.
Thanks in advance!

我以为我读过一次关于最大值的信息z-index。也许我错了。
提前致谢!

回答by Netizen110

These are the max values.

这些是最大值。

Browser         Max z-index value  When exceeded, value changes to:
Internet Explorer 6 2147483647  2147483647
Internet Explorer 7 2147483647  2147483647
Internet Explorer 8 2147483647  2147483647
Firefox 2           2147483647  *element disappears*
Firefox 3           2147483647  0
Safari 3            16777271    16777271
Safari 4            2147483647  2147483647
Chrome 29           2147483647  2147483647
Opera 9             2147483647  2147483647

Found it somewhere on the web.

在网上的某个地方找到了它。

回答by Netizen110

Incredibly, this is the chrome's max z-index value.

令人难以置信的是,这是 chrome 的最大 z-index 值。

.css('z-index', '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999').css('z-index')

If you add one more digit it will go to 1e+308

如果您再添加一位数字,它将转到 1e+308

回答by Alex Vang

Found some newer information from 2012:

找到了 2012 年的一些新信息:

"Chrome, Opera and IE9 seem to be the only browsers supporting a true infinite value for the z-index, while Firefox is still using 2147483647 and Safari now engages in some strange rounding off behavior after a number exceeds 16 digits in length."

“Chrome、Opera 和 IE9 似乎是唯一支持 z-index 真正无限值的浏览器,而 Firefox 仍在使用 2147483647,而 Safari 现在在数字长度超过 16 位后会进行一些奇怪的四舍五入行为。”

Here is the source: World War Z-index

来源: World War Z-index