CSS - max z-index value [duplicate]

2019-01-13 01:19发布

This question already has an answer here:

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

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

3条回答
兄弟一词,经得起流年.
2楼-- · 2019-01-13 01:53

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

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

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

查看更多
女痞
3楼-- · 2019-01-13 01:54

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.

查看更多
走好不送
4楼-- · 2019-01-13 01:56

Found some newer information from 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."

Here is the source: World War Z-index

查看更多
登录 后发表回答