<div id="really-tall-container">
<div id="menu-holder">
<div id="inner-menu">
<div id="logo">
LOGO
</div>
<div id="menu">
<a href="https://twitter.com/thisisfjolt">Twitter</a>
<a href="https://fjolt.com/article/css-sticky">Article</a>
</div>
</div>
</div>
<div id="content">
<p>This menu will follow you for a little while, and then stop following you</p>
</div>
</div>
body {
background: #14192f;
color: white;
}
#really-tall-container {
height: 3000px;
}
#menu-holder {
height: 300px;
top: 0;
left: 0;
width: 100%;
position: absolute;
}
#inner-menu {
position: sticky;
top: 0;
justify-content: space-between;
padding: 1rem;
box-sizing: border-box;
background: rgba(0,0,0,0.5);
align-items: center;
display: flex;
height: 5rem;
}
#menu {
display: flex;
align-items: center;
}
#menu a {
color: white;
font-size: 1.25rem;
padding: 0.25rem 1rem;
margin: 0 0 0 1rem;
display: block;
}
#logo {
font-weight: 600;
font-size: 2rem;
letter-spacing: 1px;
opacity: 0.7;
}
#content {
padding: 0.25rem 2rem;
margin: 6rem 2rem;
line-height: 2rem;
color: rgba(255,255,255,0.5);
text-align: center;
background: #3a426929;
border-radius: 10px;
font-size: 1.5rem;
letter-spacing: 0.5px;
font-weight: 100;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.