Open In App

HTML | <a> download Attribute

The download attribute is used to download the element when the user clicks on the hyperlink. It is used only when href attribute is set. The downloaded file name will be the value of the attribute. The value of the attribute will be the name of the downloaded file. If the value is removed then original filename used. 

Syntax:



<a download="filename">

Attribute Values: It contains single value filename which is optional. It specifies the new filename for the downloaded file. 

Example: 






<!DOCTYPE html>
<html>
 
<head>
    <title>
      HTML a download Attribute
  </title>
</head>
 
<body>
 
    <p>Click on image to download
        <p>
 
            <a href=
               download>
            <img src=
                 alt="gfg"
                 width="500"
                 height="200">
            </a>
 
</body>
 
</html>

Output:

  

Supported Browsers: The browser supported by HTML <a> download Attribute are listed below:

Article Tags :