Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 value for chrome?

like image 605
PulledBull Avatar asked Aug 09 '10 18:08

PulledBull


People also ask

What is the maximum Z Index Value?

The maximum range is ±2147483647. In CSS code bases, you'll often see z-index values of 999, 9999 or 99999.

What does Z Index 1000 mean?

z-index defines which positioned element appears on top (Sort of like layers). So z-index: 1000 would appear on top of a z-index 999 . Doing z-index: 1001 is an an attempt to appear "on top" of a item with z-index: 1000.

What is the default Z Index Value?

The default z-index value of all the elements on a web page is auto, which corresponds to 0 where no z-index is assigned. An element with z-index: -1 will be displayed behind all other elements on the page, assuming they are given no z-index values.

What is the Z index in CSS?

Z Index ( z-index ) is a CSS property that defines the order of overlapping HTML elements. Elements with a higher index will be placed on top of elements with a lower index. Note: Z index only works on positioned elements ( position:absolute , position:relative , or position:fixed ).


3 Answers

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

becomes 1e+308. If you add another digit after it becomes "inf".

like image 86
meder omuraliev Avatar answered Oct 14 '22 00:10

meder omuraliev


Being a 32-bit browser, you found the highest value.

2147483648 = 2^31

like image 21
Joshua Wooward Avatar answered Oct 13 '22 23:10

Joshua Wooward


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.
like image 36
Dahan Gong Avatar answered Oct 13 '22 23:10

Dahan Gong