<nav>
<a href="#section1">Section 1</a>
<a href="#section2">Section 2</a>
<a href="#section3">Section 3</a>
</nav>
<section id="section1">
<h1>Section 1</h1>
<a href="#section2">Scroll to Section 2</a>
</section>
<section id="section2">
<h1>Section 2</h1>
<a href="#section3">Scroll to Section 3</a>
</section>
<section id="section3">
<h1>Section 3</h1>
<a href="#section1">Back to Section 1</a>
</section>
html {
scroll-behavior: smooth;
}
body {
font-family: Arial, sans-serif;
}
nav {
position: fixed;
top: 0;
width: 100%;
background-color: #282c34;
padding: 10px;
text-align: center;
}
nav a,
section a {
margin: 0 15px;
color: white;
text-decoration: none;
font-size: 18px;
}
section {
height: 100vh;
padding: 50px;
background-color: #f0f0f0;
}
#section1 {
background-color: #8e44ad;
color: white;
}
#section2 {
background-color: #3498db;
color: white;
}
#section3 {
background-color: #2ecc71;
color: white;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.