Replace image via css

I am writing code in a stylish firefox plugin to change the displayed image.

The image property does not have a div tag, so I have to use this:

img[src*="s_dschjungelplanet"]{ ########## } 

Thus, it will replace "s_dschjungelplanet" anywhere on the page, in img src.

So my main problem is that I'm not sure HOW to say to replace src = "xxx".

Ta for answers

+6
css replace image stylish
source share
3 answers

There is no easy way. I think you will be better off with greasemonkey scripts, as with a simple script like this you can change the URL.

As far as I know, you cannot change the URL only css. It was the closest that I could only come with css:

 img[src*="s_dschjungelplanet"]{ width:0; height:70px; padding-right:250px; background:transparent url(http://i.stackoverflow.com/Content/Img/stackoverflow-logo-250.png) top left no-repeat; } 
+8
source share

You can try the following:

IMG [src = "s_dschjungelplanet"] {content: url ("myfavorite.png"); }

Works in Chrome, not Firefox ...

+4
source share
 img[src*="http://url-of-image-to-be-replaced.jpg"]{ background-image: url("https://url-of-image-you-want-to-display.jpg"); width:38px; display:inline-block; padding:38px 0 0 0; height: 0px} 

Change the width and addition to your specifications. It worked for me.

+2
source share

All Articles