Resolution switching: Same size, different resolutions
a guest Apr 12th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- If you're supporting multiple display resolutions, but everyone sees your image at the same real-world size on the screen, you can allow the browser to choose an appropriate resolution image by using srcset with x-descriptors and without sizes — a somewhat easier syntax! You can find an example of what this looks like in srcset-resolutions.html (see also the source code):
- <img srcset="elva-fairy-320w.jpg,
- elva-fairy-480w.jpg 1.5x,
- elva-fairy-640w.jpg 2x"
- src="elva-fairy-640w.jpg" alt="Elva dressed as a fairy">
RAW Paste Data