When I click “Projects” on my navbar, it doesn’t go to the top of the projects page because the navbar is in front of it. I have tried fixing it with scroll-margin-top: 7vh (navbar height), projects::before, and creating a new div above the actual projects section for it to scroll to. None of it works.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Personal Portfolio Webpage - Build a Personal Portfolio Webpage
Hi!
Are you referencing the #projects::before and #projects-anchor? I know its messy right now, I’m just trying things, these are supposed to come a little before #projects so that I will see #projects as the first thing even with the navbar
Yes what is shown in the picture is exactly what I want!
For some reason though the top of the projects page that says projects is cut off when I click on the projects navbar. I’m using Chrome which I feel like should work normally
That’s what happens when I click Projects. I’m using Firefox. Maybe you can test another browser. Do you have any browser extensions enabled which might interfere? (Although I have a ton of extensions)
Thats so weird, I just tried on chrome, firefox, edge, and installed duckduckgo to try it. It only worked for firefox. I don’t think its an extension issue
Yay! I tried using the project-anchor again, and I think I may have just forgotten to add the visibility: hide? I just removed it though and it didn’t seem to make a difference so I don’t know how I fixed it. I do have another problem though, Im basically done but I removed the borders from the divs and now suddenly theres space above and below my contact section. Also it smooth scrolls on chrome but not edge.
Updated code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Bart Portfolio Website</title>
</head>
<body>
<nav id="navbar">
<h1><a class="nav" href="#welcome-section">About</a></h1>
<h1><a class="nav" href="#projects-anchor">Projects</a></h1>
<h1><a class="nav" href="#contact">Contact</a></h1>
</nav>
<div id="welcome-section">
<h1 id="name">Hi, I'm Bart<hr></h1>
<h2>Not <i>yet</i> a web developer</h2>
<p>It seems that some browsers work better for scrolling smoothly and scrolling to the top of the div correctly... Firefox allowed projects page to show with just the scrolling-margin-top: 7vh, but others needed the project-anchor.</p>
<div id="animation"></div>
</div>
<div id="projects-anchor"></div>
<div id="projects">
<h1 id="name">Projects</h1><hr>
<h2>Check out these awesome projects!</h2>
<p>put some boxes of projects like in the example. CSS grid? divs?</p>
<div class="grid">
<a class="project-tile" href="https://mtgcardsmith.com/user/Forestwalker32/cards"><img class="project-img" src="https://s3.us-east-1.wasabisys.com/mtgcardsmith-wasabi/mtgcardsmith/view/complete/thumbs/2025/7/3/1751549766549739.png" ></a>
<a class="project-tile" href="https://scratch.mit.edu/users/bob978321/"><img class="project-img" src="https://uploads.scratch.mit.edu/get_image/user/61196505_300x300.png" ></a>
<a class="project-tile" href="https://scratch.mit.edu/projects/884841096/"><img class="project-img" src="https://uploads.scratch.mit.edu/get_image/project/884841096_360x270.png" ></a>
</div>
</div>
<div id="contact">
<h3>Contact me!</h3>
<p>Gmail: <a href="mailto:bscheer078@gmail.com" target="_blank">bscheer078@gmail.com</a></p>
<p>freeCodeCamp: <a href="https://www.freecodecamp.org/BartScheer" id="profile-link" target="_blank">https://www.freecodecamp.org/BartScheer</a></p>
<p>GitHub: <a href="https://github.com/BartDKbits?tab=repositories" target="_blank">https://github.com/BartDKbits?tab=repositories</a></p>
<p>Linkedin: <a href="https://www.linkedin.com/in/bart-scheer/" target="_blank">https://www.linkedin.com/in/bart-scheer/</a></p>
</div>
</body>
</html>