I’m trying to create a website (beginner-level stuff), and I encounter a problem with the anchor (<a>) tag. First of all, let me put my the code (as always, the smallest possible file that represents the error):
_File: index.html
“`
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>Welcome to my website!!!</h1>
<nav>
<ul>
<li><a href=”#about”>About section</a></li>
<li><a href=”contact.html”>Contact</a></li>
</ul>
</nav>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h2 id=”about”>This is the about section.<br> You can learn more about the site…</h2>
<a href=”#”>Back to top</a>
</body>
</html>
_File: contact.html
“`
<!DOCTYPE html>
<html>
<head></head>
<body>
<nav>
<ul>
<li><a href=”index.html”>Home page</a></li>
<li><a href=”index.html/#about”>About</a></li>
</ul>
</nav>
</body>
</html>
So, when I click on the first link in the _**index.html**about_**contact.html**about_**index.html_**index.html
If I click the second, everything works fine. If I click the first link, however, it will indeed send me to the **about**_index.html**_contact.html
If I hover my mouse over the link that sends me to that page, it will show the following path in the bottom left corner of the window: **file:///home/username/project_dir/index.html/contact.html**_index.html