Sometimes, we want to make an image link download on click with HTML.
In this article, we’ll look at how to make an image link download on click with HTML.
How to make an image link download on click with HTML?
To make an image link download on click with HTML, we set the download
attribute.
For instance, we write
<a download="custom-filename.jpg" href="/path/to/image" title="ImageName">
<img alt="ImageName" src="/path/to/image" />
</a>
to set the download
attribute to the file name of the downloaded file.
Then when we click on the link, the file at the href
path will be downloaded.
Conclusion
To make an image link download on click with HTML, we set the download
attribute.