I’m actually surprised it didn’t do this already.
So if I understand it correctly:
<img height=50px width=75px...>
<style>
img {
width: 100%;
height: auto
}
</style>
CSS doesn’t currently use 50px/75px to calc height and needs img downloaded, but with this it can use them.
Conversation
And already on in Firefox and Chrome (so guessing new Edge too) so once Safari does ship this that’s all the major browsers.
Quote Tweet
Replying to @cramforce @AMPhtml and @igalia
Computing aspect ratio from width/height was enabled by default in Chrome 79. chromestatus.com/feature/569526 I would guess it's enabled in Edge 79 as well, and so presumably when the next version of Safari ships, this will be enabled by default in all browsers.
Replying to
Yep, that’s it, I’ve been hoping this would happen for years, finally got to writing bug reports (suggestions) in 2017:
bugs.webkit.org/show_bug.cgi?i
Although, side note, you shouldn’t really use “px” in the width/height attributes:
developer.mozilla.org/en-US/docs/Web
1
1
Replying to
Oh yeah - typo. Would have saved me 4 chars too and resulted in much less editing to squeeze it all in! 😀
2



