<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content=
"width=device-width, initial-scale=1.0" />
<title>Scroll</title>
<style>
html {
/* This property makes the html
page to scroll smoothly */
/* If you want to directly move to the
section without scrolling, remove
this scroll-behavior property*/
scroll-behavior: smooth;
}
/* Some basic styling for testing
our functionality */
.links-container {
display: flex;
justify-content: space-between;
}
.sections {
display: flex;
flex-direction: column;
place-items: center;
gap: 100rem;
}
</style>
</head>
<body>
<div class="links-container">
<a href="#id1">Go to Section 1</a>
<a href="#id2">Go to Section 2</a>
<a href="#id3">Go to Section 3</a>
<a href="#id4">Go to Section 4</a>
</div>
<div class="sections">
<section id="id1">
<h1>Section 1</h1>
</section>
<section id="id2">
<h1>Section 2</h1>
</section>
<section id="id3">
<h1>Section 3</h1>
</section>
<section id="id4">
<h1>Section 4</h1>
</section>
</div>
</body>
</html>