Hi,
I want to display a play icon on top of an image on hover. I have got it working on FF,Chrome etc. But it doesnt work in IE7. Please tell me how to make it work in IE. Thanks a lot in advance.
CSS
That works fine for me in IE7 so I must be missing something. It won’t work in IE6 because of the hover on the div but IE7 works out of the box and the image changes on hover. I copied it locally and used my own images to test.
You do have a stray bracket here but it wasn’t causing a problem although it needs to be removed.
.overlay { background-image:non[B]e)[/B];
Is there some other code that might be affecting this that we haven’t seen?
Is there some other code that might be affecting this that we haven’t seen?
No although I need this bit on another PHP file -I am running it now as a standalone html - for testing.
I am running IE7 (version 7.0.6001.18000) on Windows Vista 64.
Hmmm I don’t have vista 64 to test unfortunately although “usually” there is no difference but with IE you can never rule anything out.
What happens when you rollover? Does it stay blank or is there something happening? Try changing the image for a solid background color to see if it’s working.
You have the z-index correct and apart from the stray bracket I can’t see a reason for a problem. The element has haslayout and should be good to go.
Do you have any stray characters above the doctype? If you have anything above the doctype including html comments (or remnants of php code) then that will trigger quirks mode and the hover won’t work.
This is one of those times when I need to get my hands on the real page and see what’s going on. Do you have a link? If you want it kept private you can PM me (this time only) with the link and I won’t disclose it.
Thank you, Paul. I really appreciate the help and your patience.
What happens when you rollover?
Nothing happens… ie., as in the normal state I can see the bottom image.
I tried with a solid color as you suggested.
Replaced this line:
.overlay:hover { background: transparent url(images/play.png) no-repeat center center;}
with this:
.overlay:hover { background-color:red;}
I am afraid the results are the same.
Do you have a link?
Not yet… I am just running this from my local PC.
I copied whatever there’s on the file and posted it before .
Thanks a lot Paul.
I cleared the cache and all the temporary files in IE, but no change.
I do not have much access to other computers… I may have to send a zip file to someone else to check.
You need to add a fake background so that the focus doesn’t drop through the empty element. The image doesn’t need to exist but if you don’t want missing image errors in your server logs then just make a 1px x 1px fully transparent pixel image and use that instead.
I tried adding a link to the image and getting different results. Chrome doesnt show the link on hover and IE shows it on the borders.
I set a display:block with width and height specified on the a tag.
Kindly see the code attached. (changes to the code are given in red)
You have to think logically abut what is happening.
On hover you are placing another div on top of your image and on top of your link. There will be no link to click because it is under the div. You can’t click through an element like that.