Adam
Adam

Reputation: 9049

my div tag is unclickable when there is an IMG tag underneath in ie7 ie8

Let's uncomplicate things

http://jsfiddle.net/Hh7Mn/

<div style="width:100px; height:200px; border:10px solid; cursor:pointer; position:absolute; z-index:99;">dsdsfdsfsdfdsfdsf</div>



<img style="z-index:0;" id="default_image" src="http://www.takeprideinutah.org/wp-content/uploads/2009/04/trees.jpg" alt=""/>

Why is the center of the div unselectable and undetectable in ie?

EDIT:

Sorry the code is now the same on both jsfiddle and stack

Upvotes: 0

Views: 270

Answers (3)

Alex
Alex

Reputation: 1609

change the z-index of the image to -1 and it will work: http://jsfiddle.net/kPtkd/1/

Upvotes: 0

superUntitled
superUntitled

Reputation: 22527

You need to declare a position when using a z-index.

<img style="z-index:0;position:relative;" id="default_image" src="http://www.takeprideinutah.org/wp-content/uploads/2009/04/trees.jpg" alt=""/>

z-index only works on positioned elements (position:absolute, position:relative, or position:fixed)

Upvotes: 1

Web_Designer
Web_Designer

Reputation: 74530

I would suggest giving your links a greater z-index value:

a{
z-index:12;
}

Upvotes: 0

Related Questions