Responsive image using picture element

suggest change

Code

<picture>
  <source media="(min-width: 600px)" srcset="large_image.jpg">
  <source media="(min-width: 450px)" srcset="small_image.jpg">
  <img src="default_image.jpg" alt="">
</picture>

Usage

To show different images at different screen widths, include every candidate in a <source> inside <picture>, as in the example. The browser uses the first <source> whose media query matches, so order matters.

Result

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents