Using responsive images in HTML - HTML | MDN
Images on the web are hard. After trying and failing so many times before, now I finally understand how to configure srcset and sizes attributes to serve differently sized images for different viewports.
Also worth checking out: Image Display Elements by Stephanie Eckles.