I have a sticky sidebar that I'm trying to keep inside parent class. That is staying inside the .inner box.
Currently, it is overflowing into the .outside box.
Here is the JSFiddle with an example - https://jsfiddle.net/dky2eb3m/10/
HTML:
<div class="parent">
<div class="other">
</div>
<div class="inner">
<nav>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</nav>
<div class="content">
One
</div>
<div class="content two">
TWO
</div>
<div class="content three">
Three
</div>
</div>
</div>
<div class="outside">
</div>
SCSS
.content {
height: 400px;
background: red;
&.two {
background: green;
}
&.three {
background: grey;
}
}
.other {
height: 300px;
background: yellow;
}
.parent {
//overflow: hidden;
}
nav {
position: sticky;
top: 25%;
left: 100%;
height: 0;
ul {
display: flex;
flex-direction: column;
li {
list-style: none;
position: relative;
background: white;
width: 80px;
height: 80px;
display: block;
border-radius: 10px;
color: #f47324;
}
}
}
.outside {
height: 400px;
background: orange;
}