How can I add image on top of the other I cant make the list image as background as it generic by php I just want to add a play button on top of the images when hover <ul id="list_profile"> <li class=""> <a href="#/"><img width="440" height="450" alt="img4" src="/uploads/img4.jpg"></a> </li> <li class=""> <a href="#/"><img width="440" height="450" alt="img3" src="/uploads/img3.jpg"></a> </li> </ul> HTML: CSS #list_profile li img { width:212px; height:222px; margin-bottom:10px; z-index:-1;} #list_profile li img:hover { background: url("/images/galleryhover.png") no-repeat scroll left top transparent ; height: 222px; width: 212px; z-index:999; } HTML:
Try something like this: Make the first image something like this: position: relative; top: 0; left: 0; Second image like this: #list_profile li img:hover { background: url("/images/galleryhover.png") no-repeat scroll left top transparent ; position: absolute; top: 30; height: 222px; width: 212px; }
set the hover state background on the A, then for a:hover make the IMG tag be opacity:0; Though really given the ridiculous sizes, I'm wondering just what the devil you are doing for images (that may not even belong in the markup in the first place!)... Much less things like resizing the IMG from the CSS when you're stating width and height in the markup; really oddball stuff.
Look online before you ask here. The code would be <link rel="stylesheet" type="text/css" href="linktoyourstylesheet.css"> HTML: Placed inside the <head> tag in your HTML.
If you choose to do it this way you really need to have a look at this: http://css-tricks.com/snippets/css/cross-browser-opacity/