Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

HTML | <source> srcset Attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The HTML srcset attribute is used to specifies the URL of an image to use in different situations. when <source> is used in <picture> it is required

<source srcset="URL">

Attribute Values 

  • URL: It specifies the URL of image



<!DOCTYPE html>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">
        <source media="(min-width: 600px)"
        <source media="(min-width: 400px)"
        <img src=

Output: change the size of browser 



Supported Browsers:The browsers supported by HTML srcset Attribute are listed below 

  • Google Chrome 38
  • Firefox 38
  • Apple Safari 9
  • Opera 25
  • Edge 18


My Personal Notes arrow_drop_up
Last Updated : 19 Jul, 2022
Like Article
Save Article
Similar Reads
Related Tutorials