3 ms·
It's possible and well-known: https://css-tricks.com/aspect-ratio-boxes/ https://css-tricks.com/aspect-ratio-boxes/. Also, for images, there is the simpler solu
by vbernat 8y ago
It's possible and well-known: https://css-tricks.com/aspect-ratio-boxes/ https://css-tricks.com/aspect-ratio-boxes/. Also, for images, there is the simpler solution of specifying real width/height in the img tag, then use CSS with "max-width: 100%; height: auto" or anything similar.
- megous 8y agoIt doesn't work in chrome. Try (test.png doesn't exist): <img width="100" height="100" style="width:100%;height:auto;" src=test.png> and you'll get 16x16px placeholder image. In Firefox, it works.