Maximum z-index value for chrome
in Chrome when i set z-index to 2147483647 it changes to 1e+06.. what is the maximum possible val开发者_如何转开发ue for chrome?
.css('z-index', '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999').css('z-index')
becomes 1e+308
. If you add another digit after it becomes "inf".
Being a 32-bit browser, you found the highest value.
2147483648 = 2^31
It is 2147483647 (0x7fffffff).
According to the source code of WebKit, the "zIndex" has been an "int" value since the first commit: https://chromium.googlesource.com/chromium/src/+/d869b93fe74f4d6cb2dd6f6c3e9bf9daee39ba19/third_party/WebKit/WebCore/khtml/rendering/render_style.h#828 .
And tests on Chrome 35 (32-bit), 45 (64-bit), 74 (64-bit) (for Windows) confirm it.
I also tested Firefox 66 and max of zIndex is also 2147483647 there.
Notes:
- WebKit: Chrome (Chromium) once used it to render web pages and some years ago it's renamed into "blink" and integrated into Chromium.
精彩评论