keha76

HTML5 Adaptive Images

May 16th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.46 KB | None | 0 0
  1. <!-- using picture element -->
  2. <picture alt="image title">
  3.    <source src=hi_resolution.png media="min-width:800px">
  4.    <source src=mid_resolution.png media="min-width:480px">
  5.    <source src=low_resolution.png>
  6.       <!-- fallback for browsers without support -->
  7.       <img src=mid_resolution.png alt="image title">
  8. </picture>
  9.  
  10. <!-- using srcset attribute -->
  11. <img src="low_resolution.jpg" srcset="hi_resolution.jpg 2x, veryhi_resolution.jpg 6.5x" alt="title">
Advertisement
Add Comment
Please, Sign In to add comment