I am currently working on designing a shopping cart layout for a website that allows users to order food from a restaurant. I want the shopping cart to remain fixed on the screen, but be scrollable when there is an overflow of items being added.
This is a basic representation of the code I am using to achieve this functionality.
My goal is to set a relative position within a fixed position div and make the cart scrollable when needed.
I have been attempting to solve this issue for hours with no success.
.wrapper {
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.5);
position: fixed;
width: 200px;
}
.sidebar {
position: relative;
height: 100%
}
.cart {
overflow-y: auto;
}
<div class='wrapper'>
<div class='sidebar'>
<div class='cart'>
<div class='item'>
[Lorem Ipsum content here]
</div>
</div>
</div>
</div>