HTML Links for File Downloads
HTML links can also be used to create file downloads links by providing the file path to the href
attribute on <a>
element as shown below.
Files can be of any below types.
<a href="files/sample.txt">File Download Link</a>
Example
Check the outcome of the below HTML document to see how it looks.
<!doctype html>
<html lang="en">
<head>
</head>
<body>
<h1>HTML Links for File Downloads</h1>
<a href="files/sample.txt">Download Text file</a><br>
<a href="files/sample.png">Download Image file</a><br>
<a href="files/sample.pdf">Download PDF File</a><br>
<a href="files/sample.zip">Download ZIP File</a><br>
</body>
</html>
Overall
HTML links can be used to define file download links.