I recently added a fixed sidebar to my website:
However, I'm facing an issue where the sidebar appears in front of my full-page header when I set its position to fixed. What I actually want is for the sidebar to start after the header as if it were positioned absolutely with top: 100vh, but still remain fixed when scrolling down.
Is there a way to achieve this desired effect? Thank you for any help!
body {
margin:0;
}
#header {
height: 100vh;
width:100%;
position:relative;
background-color:blue;
}
#main {
margin-left: 20vw;
height: 100vh;
}
sidebar {
width: 20vw;
height: 100vh;
top: 0;
left: 0;
background-color: #130E0A;
position: fixed;
z-index: 1;
}
<!DOCTYPE html>
<html>
<head>
<title>Exploring Controversy: The Four Color Theorem and Computer Proofs</title>
<meta name='viewport' content='initial-scale=1.0'>
<meta charset='utf-8'>
</head>
<body>
<section id='header'></section>
<section id='main'>
<sidebar></sidebar>
<div id='timeline' class='cd-container'></div>
</section>
</body>
</html>