Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the code
<style>
    .datepicker {
        z-index: 1181 !important;
    }
</style>


What I don't know is why using 1181. How to find the clue in style file?

What I have tried:

google search:
The z-index property specifies the stack order of an element.

It means 1181 what?
Posted
Updated 2-Aug-17 6:00am

The number refers to the level in the current stacking context[^]; an element with z-index[^] 2 is stacked higher than an element with z-index 1, for example.

A stacking level of 1181 means that will be stacked higher than everything with z-index < 1181, but lower than everything with z-index > 1181. The number seems very high, but that's fine: you don't need all an element for all stacking levels in-between; if you only have an element with z-index 1 and one with z-index 1181, the one with 1181 will just be stacked above the one with z-index 1, so there it wouldn't matter if it was 1181 or 2.

So why the developer used 1181 is something we can't really know. I doubt there are actually 1180 other stacked elements (or more, because z-index can be negative as well). It could be that he used huge gaps between z-indexes just in case he would add new stacked elements later on, but I'm just guessing here.
 
Share this answer
 
v3
z-index specifies the order in which items are "layered": a higher number means that the item is "drawn over the top of" lower numbered objects.

A z-index of 1181 may just means that it's a random number that is greater than any other expected item, as so on the top of everything else - it has no other special meaning.
Ask the person who wrote it why he picked 1181 instead of 9999 if you really need to know - it's probably a birthdate or similar!
 
Share this answer
 
Comments
Member 12658724 2-Aug-17 12:13pm    
It maybe the highest number. Does it mean .datepicker style can be override since it is not important?
OriginalGriff 2-Aug-17 12:25pm    
No, it's probably important *within the context of this particular application*

That doesn't mean it's important outside it. There may be other z-indexes which are designed to be higher or lower than 1181 to specifically set the display order.
Member 12658724 2-Aug-17 12:33pm    
So the exclamation mark ! does not mean not as in C#.
In C#, != means not equal something. I thought !important meant not important
OriginalGriff 2-Aug-17 12:48pm    
! has multiple uses in C# as well:
a != b is a boolean "a is not equal to b"
!a is a boolean "not a"

In CSS, !important has a specific meaning:
https://www.w3.org/TR/CSS2/cascade.html#important-rules

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900