<nav class="nav">
  <button class="btn btn-1" data-section="#section1">section 01</button>
  <button class="btn btn-2" data-section="#section2">section 02</button>
  <button class="btn btn-3" data-section="#section3">section 03</button>
</nav>
<div class="full-page" id="section1">section 01</div>
<div class="full-page" id="section2">section 02</div>
<div class="full-page" id="section3">section 03</div>
.nav {
  padding: 0.75rem 1rem;
  background-color: #ddd;
  display: flex;
  justify-content: space-around;
  position: sticky;
  top: 0;
}
.btn {
  display: inline-block;
  background-color: #ccc;
  color: #444;
  text-decoration: none;
  padding: 0.25rem 1.2rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.full-page {
  height: 100vh;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  font-weight: 800;
}
const btns = document.querySelectorAll(".btn");
const section1 = document.querySelector("#section1");
const section2 = document.querySelector("#section2");
const section3 = document.querySelector("#section3");

btns.forEach((btn) =>
  btn.addEventListener("click", (e) => {
    const section = document.querySelector(e.target.dataset.section);
    section.scrollIntoView({ behavior: "smooth"});
  })
);
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.