0

I’m trying to find an image that has a src that starts with a particular url and hide it. I can do it but it doesn’t work on IE.

Is there a version of this css (maybe javascript) that will also work for edge and IE

img[src ^= "https://www.google"]{
  display: none;
}
grabury
  • 4,797
  • 14
  • 67
  • 125

2 Answers2

0

Use this CSS3 attribute selector:

img[src*="hideme"] {
        display: none;
    }

As usual, some versions of IE are known to have bugs with CSS3 attribute selectors. The SitePoint Reference is useful: Link

Hasnnnaiin
  • 73
  • 7
0

Below is the example tested with IE 11 and MS Edge browser version 44. In both and other browsers the code is working fine.

<!DOCTYPE html>
<html>
<head>
<style>
img[src*="i.postimg.cc"] {display: none;}
</style>
</head>
<body>

<img src="https://i.postimg.cc/13D5v67n/223.png" alt="Trulli" width="500" height="333">

</body>
</html>

Reference:

Hide image of specific size, by CSS? (Refer the accepted answer in the thread.)

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19