i would like to show delete button at top right corner to image? how could i achieve this?
my html is like this :-
main image :
<img id="' + id + '" src="../Images/DefaultPhotoMale.png" class="' + item + '" width="40" height="40" alt="image" title="' + projectTitle + '" style="cursor:pointer" />
x button image to display in top-right of above image
'<img id="' + item.Soid + '" src="../Images/RemoveButton.ico" style="display:none" title="Remove Specialization" />
No background image set please, i need click event for that delete button something like this :
Just add position:absolute; top:0; right:0; to the CSS for your button.
just wrap your image inside a div and your button inside another div, so the button will be cascaded directly below the image then you can style your button's div as you like for example make the button centered below the image as in the sample provided.
Usual approach with position: relative
and position: absolute
.
HTML:
<div class="img-wrap"> <span class="close">×</span> <img src="http://lorempixel.com/100/80"> </div>
CSS:
.img-wrap { position: relative; ... } .img-wrap .close { position: absolute; top: 2px; right: 2px; z-index: 100; ... }
Extended demo (+ JS interaction) http://jsfiddle.net/yHNEv/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With