Is there a CSS selector for IMG that has been limited to a maximum width or maximum height?

If I define the following CSS rule:

img { max-width: 200px; max-height: 200px; border: 1px solid black; } 

Is there a pure CSS way to detect image objects that are larger without size restrictions? Something semantically matches:

 img:resized { border-color: green; } 

Alternatively: is there a way to detect large images in the first place? For instance:

 img { border: 1px solid black; } img[width>200px], img[height>200px] { max-width: 200px; max-height: 200px; border-color: green; } 

Thanks!

+4
source share
1 answer

No, there are no CSS selectors that can request style properties declared or computed, since rendering of DOM elements is not related to the DOM hierarchy.

+8
source

All Articles