I am trying to make two divs, one inside the other. The inner div is larger than the outer div, the outer div has overflow:scroll, and the inner div has m
So the answers here don't actually solve the problem! (Although super detailed to the reason why it doesn't work)
I needed a solution. Here's mine for future readers. Use a combination of display:flex; with pseudo ::after element to fake the presence of a div to provide the margin needed.
.wrapper {
display: flex;
width: 400px;
height: 100%;
padding: 40px;
background: lightGrey;
}
.lists_container {
display: flex;
flex-direction: row;
justify-content: flex-start;
overflow: auto;
position: relative;
background: grey;
padding: 40px;
margin: 40px;
width: 100%;
}
.card {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 250px;
max-width: 500px;
height: 100px;
margin: 50px 0;
padding: 20px;
background: orange;
margin-right: 30px;
}
.card.last::after {
content: '';
position: absolute;
right: -100px;
width: 40px;
height: 100%;
background: red;
}