I'm currently building a test website and trying to implement a download link for a file (.txt). I've seen many different ways of doing it in particular on Stack. However nothing seems to be working. It always opens the files instead of downloading it.
Here is the code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test - Download</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<img src="logo.png" alt="test Logo">
<div class="spacer"></div>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="team.html">Team</a></li>
<li><a href="#">Download</a></li>
</ul>
</nav>
</header>
<main>
<h1>Download </h1>
<p>Choose your platform:</p>
<ul>
<li>
<a href="img/A.png" download="bottle"> Download </a> <!-- THIS IS NOT WORKING-->
</li>
<li><a href="#">Mac</a></li>
<li><a href="#">Linux</a></li>
</ul>
</main>
<footer>
<p>© 2023 test</p>
</footer>
</body>
</html>
Thank you for your time.
I tried a lot of things thta i've seen on stack but it always opens the file instead of downloading it