CSS 没有来源的图像选择器

CSS selector for image without source

我知道这很奇怪,但是我怎么能 select 文档中没有来源的所有 IMG(我说的是 CSS select 或者)

也就是我要select

<IMG>

但不是

<IMG src="/my_file.png">

答案是

img:not([src]) {
   /* style here */
}

您需要使用 :not 选择器

img:not([src]) {
   /* style here */
}