A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-source-srcset-attribute/ below:

HTML | <source> srcset Attribute

HTML | <source> srcset Attribute

Last Updated : 19 Jul, 2022

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
Syntax: 
 

<source srcset="URL">


Attribute Values 
 


Example: 
 

html
<!DOCTYPE html>

<html>

<head>

    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">

</head>

<body>

    <picture>

        <source media="(min-width: 600px)" 
                srcset=
"https://media.geeksforgeeks.org/wp-content/uploads/20190328185307/gfg28-300x83.png">

        <source media="(min-width: 400px)" 
                srcset=
"https://media.geeksforgeeks.org/wp-content/uploads/20190809013546/gfg_350X350-300x300.png">

        <img src=
"https://media.geeksforgeeks.org/wp-content/uploads/20190521140445/gfglogo2.png" 
             style="width:auto;">

    </picture>

</body>

</html>

Output: change the size of browser 
 


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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4