Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE7 does not respect z-index

Running in compatibility mode the calendar below renders behind the textboxes below. IE8 displays the calendar how I need it to.

My CSS

.MyCalendar .ajax__calendar_container 
{
border:1px solid #7F9DB9; 
background-color: #ffffff; 
z-index : 1004 ;   
width:190px;
}

the textboxes which are overlaying the calendar don't have their z-index set anywhere although I have tried in my server side code to set their z-index to -1 if I detect IE7 to no avail. Any suggestions? alt text

like image 605
user48408 Avatar asked Sep 23 '09 15:09

user48408


People also ask

Why your Z index is not working?

You set z-index on a static element By default, every element has a position of static. z-index only works on positioned elements (relative, absolute, fixed, sticky) so if you set a z-index on an element with a static position, it won't work.

Does Z Index work with static positioning?

z-index only affects elements that have a position value other than static (the default). Elements can overlap for a variety of reasons, for instance, relative positioning has nudged it over something else. Negative margin has pulled the element over another. Absolutely positioned elements overlap each other.

Does Z index affect performance?

If the z-indices aren't changing often, the performance hit probably won't be noticeable at all. Even if you are changing the z-indices a lot, sorting a list of 15 items is almost instantaneous.

How do you avoid Z index?

To get <Help/> above <Heading/> without adding higher z-index , we can get <Heading/> into a separate stacking context. That way, since <Heading/> and <Help/> are in different stacking context, the <Heading/> z-index will not affect <Help/>. <Help/> would appear to on top of <Heading/> due to the order of DOM elements.


1 Answers

IE has problems with z-index. Most browsers treat the page as one continuous stacking context, but in IE, positioned elements generate a new stacking context, starting with a z-index value of 0.

As mentioned in this article:

http://trwa.ca/2012/03/ie-z-index-bug-and-how-to-squash-it/

try giving the calendar's parent element an even higher z-index.

like image 197
rhodesjason Avatar answered Sep 17 '22 15:09

rhodesjason