Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replace current html image with css

Tags:

html

css

I am having issues trying to replace this image with CSS, I have no access to the html.

http://jsfiddle.net/ES4mH/

<img 
  width="64" 
  height="64" 
  border="0" 
  style="width: 64px; height: 64px;" 
  src="http://www.nitrografixx.com/2013/lock-icon.gif">
</img>

I tried this, and while it adds the image as a background to the current image, it doesn't replace it.

img[src='http://www.nitrografixx.com/2013/lock-icon.gif'] {
  background: url(http://www.nitrografixx.com/2013/lock_bg.jpg) center !important;  
}
like image 994
user2250423 Avatar asked Dec 05 '25 10:12

user2250423


1 Answers

try this

<style>
.className{
    content:url("http://www.nitrografixx.com/2013/lock_bg.jpg");
}
</style>
<img class="className"/>
like image 70
PSR Avatar answered Dec 07 '25 11:12

PSR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!