I am new to coding with HTML and CSS and recently came across a sidebar example that caught my eye. However, I'm facing an issue where the content appears the same on all the different pages of the sidebar.
How can I make sure that the content changes based on the page?
While navigating through the web pages using the sidebar, I noticed that the URL changes but the content remains constant. I suspect there might be an error in the code or perhaps I need to create separate classes for each page, but I'm unsure about the syntax to achieve this.
<head>
<title>OpereX Project</title>
<style>
body {
font-family: "Lato", sans-serif;
}
.sidenav {
height: 100%;
width: 160px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #99ccff;
overflow-x: hidden;
padding-top: 20px;
}
.sidenav a {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 25px;
color: black;
display: block;
}
.sidenav a:hover {
color: #f1f1f1;
}
.main {
margin-left: 160px;
font-size: 28px;
padding: 0px 10px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
</style>
</head>
<body>
<div class="sidenav">
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="#clients">Clients</a>
<a href="#contact">Contact</a>
</div>
<div class=main>
<h2>Project</h2>
</div>
</body>
</html>