- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
The HTML download attribute is used to specify that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
Example
<a href="/images/myw3schoolsimage.jpg" download>Download Image</a>Copied!✕CopyIn this example, clicking the link will download the image instead of navigating to it.
Custom Filename
You can also specify a custom filename for the downloaded file by providing a value to the download attribute.
<a href="/images/myw3schoolsimage.jpg" download="w3logo.jpg">Download Image</a>Copied!✕CopyIn this case, the image will be downloaded with the name "w3logo.jpg".
Usage with Images
The download attribute can also be used with images inside an anchor tag.
<!DOCTYPE html><html><head><title>HTML a download Attribute</title></head><body><p>Click on image to download</p><p><a href="https://media.geeksforgeeks.org/wp-content/uploads/20190221234751/geeksforgeeks-logo1.png" download><img src="https://media.geeksforgeeks.org/wp-content/uploads/20190221234751/geeksforgeeks-logo1.png" alt="gfg" width="500" height="200" /></a></p></body></html>Copied!✕Copy HTMLAnchorElement: download property - Web APIs | MDN
Jul 26, 2024 · The HTMLAnchorElement.download property is a string indicating that the linked resource is intended to be downloaded rather than displayed in the browser. The value, if any, …
HTML download Attribute - GeeksforGeeks
Jul 12, 2025 · The HTML download Attribute is used to download the element when the user clicks on the hyperlink. It is used only when the href attribute is set. The downloaded file name …
HTML download Attribute - W3docs
The HTML download attribute specifies that the target will be downloaded when clicking on the hyperlink. Read and find out on what elements it can be used.
HTML Anchor download Property: Link Download - CodeLucky
Feb 7, 2025 · A comprehensive guide to the HTML anchor tag's download attribute, covering its syntax, usage, and practical examples for triggering file downloads.
Searches you might like
HTML download Attribute - CSS Portal
The HTML download attribute is a feature designed for use within <a> (anchor) tags to instruct the browser to download the target of the link instead of navigating to it.
HTML - download Attribute - Online Tutorials Library
HTML download attribute is used with anchor tag to specify that the resource ( specified in the href attribute ) will be downloaded when a user clicks on the hyperlink. It indicates that the …
HTML download link - RapidTables.com
Download link is a link that is used to download a file from the server to the browser's directory on the local disk. The download link code is written as: The code will create this link: Download …
How to Create a Download Link in HTML - Delft Stack
Mar 11, 2025 · In this article, we will explore the various methods to create a download link in HTML, ensuring that users can easily access and download the files they need. We’ll also …
How To Create a Download Link - W3Schools
You can use the HTML download attribute to specify that the target will be downloaded when a user clicks on the hyperlink. The download attribute is only used if the href attribute is set. The …