I am building a simple recipe website and I have 3 nav-links:
- HOME
- RECIPE
- ABOUT US.
My id attributes match the values in my href attributes but still, the nav links are not active or scroll down to their intended section. I have yet to make the about us section. I am using HTML, CSS, and Bootstrap, do not know any JavaScript.
<header id="header-section">
<div class="container">
<ul class="nav nav-pills">
<li class="nav-item"><a href="#header-section" class="nav-link">Home</a></li>
<li class="nav-item"><a href="#recipe-section" class="nav-link">Recipes</a></li>
<li class="nav-item"><a href="#about-section" class="nav-link">About Us</a></li>
</ul>
</div>
<section class="recipe" id="recipe-section">
<div>
<h4>My passport may be collecting dust, but my taste buds are on a global adventure!</h4>
</div>
I have tried puting the nav-links outside the header section to see if it would work but nothing. I returned them into the header section as i like how it looks with one background image for the nav-links and header section.
I see your code there has some mistakes. you have added id in wrong way you just need to add id in sections and add link path using #id. I have try to code working them. Plz check below snippet.