I was curious if it was possible to look at an images width, and if the width is less than X number, then it would get a certain class.
Essentially I want to specify three classes for images like so:
- If width is less than 100px then the image itself will have the class .small
- If width is less than 400px then the image itself will get the class .medium
- If width is less than 600px then the image itself will get the class .large
.. etc If I need to add more sizes and classes
Is this possible?
Untested, but that looks about right.
Also, if you wanted to apply these rules to all images in your document, or at least all images in a specific container, you could: