Skip to content
Related Articles

Related Articles

HTML | <source> srcset Attribute

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 14 Apr, 2021

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 4.0
  • Firefox 4.0
  • Apple Safari 4.0
  • Opera 10.5
  • Edge


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!