<body>
<header>
<h1>My Website</h1>
<nav>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</nav>
</header>
<nav class="buttons">
<ul>
<li><a href="#01" class="button">Section 1</a></li>
<li><a href="#02" class="button">Section 2</a></li>
<li><a href="#03" class="button">Section 3</a></li>
</ul>
</nav>
<section id="01" class="num001">Section 1</section>
<section id="02" class="num002">Section 2</section>
<section class="num003" id="03">Section 3</section>
</body>
/* styles.css */
html {
scroll-behavior: smooth;
scroll-padding-top: 130px;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
position: fixed;
width: 100%;
height: 100px;
inset: 0;
background-color: #333;
color: white;
display: flex;
align-items: center;
justify-content: space-around;
padding: 0 20px;
}
header h1{
font-size: 16px;
}
header nav ul {
list-style: none;
display: flex;
gap: 20px;
padding: 0;
margin: 0;
padding-left: 200px;
}
header nav ul li {
display: inline;
}
header nav ul li a {
color: white;
text-decoration: none;
}
nav.buttons {
padding: 140px 0 100px;
background-color: #444;
display: flex;
justify-content: center;
}
nav.buttons ul {
list-style: none;
display: grid;
gap: 20px;
padding: 0;
margin: 0;
}
nav.buttons ul li {
display: inline;
}
nav.buttons ul li a.button {
display: inline-block;
width: 200px;
padding: 10px 20px;
background-color: #3e68ff;
color: white;
text-align: center;
text-decoration: none;
border-radius: 5px;
transition: background-color 0.3s;
}
nav.buttons ul li a.button:hover {
background-color: #2a4ebf;
}
section {
padding-top: 40px;
height: 100vh;
display: flex;
align-items: start;
justify-content: center;
font-size: 2rem;
border-bottom: 1px solid #ccc;
background-color: red;
}
.num001 {
background-color: #f4a261;
}
.num002 {
background-color: #2a9d8f;
}
.num003 {
background-color: #e76f51;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.