CSS hide all images with matching SRC attribute

前端 未结 1 916
情深已故
情深已故 2021-01-30 12:43

Is it possible to create a CSS rule that would apply a style to any IMG tag with a SRC that contained a specific string, say \"hideme\"? For instance, if I had the following 3

1条回答
  •  一整个雨季
    2021-01-30 13:20

    Use this CSS3 attribute selector:

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

    I'd prefer to use a hideme class instead, but if you must hide an image based on its src attribute, the above is fine.

    0 讨论(0)
提交回复
热议问题