πŸŽ‰ We just launched our new React course! Get it with 20% off! πŸŽ‰
How to Make a Download Button in HTML

How to Make a Download Button in HTML

Ferenc Almasi β€’ 2020 September 18 β€’ πŸ“– 1 min read
  • twitter
  • facebook

A rather simple but often overlooked attribute in HTML is the download attribute. Simply add it to an anchor if you want to download the resource instead of opening it in a new tab. No special script or anything else needed.

<!--
  Use the download attribute to signal that the resource
  should be downloaded rather than opened in the browser
-->

<a href="/cv.pdf" download>πŸ“₯ Download my CV</a>
download.html
Copied to clipboard!

If you omit the value, the original filename will be used with its correct extension, but you can specify an alternative filename as well.

How to Make a Download Button in HTML
If you would like to see more Webtips, follow @flowforfrank

10 Best Practices for HTML
Looking to improve your skills? Check out our interactive course to master JavaScript from start to finish.
Master JavaScript

Resources:

JavaScript Course Dashboard

Tired of looking for tutorials?

You are not alone. Webtips has more than 400 tutorials which would take roughly 75 hours to read.

Check out our interactive course to master JavaScript in less time.

Learn More

Recommended