Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the highest possible z-index? [duplicate]

I couldn't find that in the specs. I am using lot of of 3rd party javascript and want to make sure that certain piece appears on top of everything else.

like image 931
flybywire Avatar asked Mar 01 '23 22:03

flybywire


2 Answers

From the CSS 2.1 Specification:

4.3.1 Integers and real numbers

Some value types may have integer values (denoted by ) or real number values (denoted by ). Real numbers and integers are specified in decimal notation only. An consists of one or more digits "0" to "9". A can either be an , or it can be zero or more digits followed by a dot (.) followed by one or more digits. Both integers and real numbers may be preceded by a "-" or "+" to indicate the sign. -0 is equivalent to 0 and is not a negative number.

Note that many properties that allow an integer or real number as a value actually restrict the value to some range, often to a non-negative value.

So the specification does not limit the range. I guess that 2^31 - 1 (signed 32-bit integer) is the limit in most implementations.

like image 162
Tamas Czinege Avatar answered Mar 13 '23 04:03

Tamas Czinege


The zIndex for an object can be as high as you want it to be(obviously obeying the signed int limit). But if you want to check if there is any other object on the page higher that what you will set dynamically, you can check this out.

like image 33
renegadeMind Avatar answered Mar 13 '23 05:03

renegadeMind