This fiddle demonstrates a container with several elements inside of it:
<div class="container">
<div class="element">Element</div>
<div class="element">Element</div>
<div class="element">Element</div>
<div class="element">Element</div>
</div>
Each element has a white rectangle as a pseudo element appearing over it.
Why are they cut off at the x-axis of the container? Why is overflow-y: scroll
affecting the x axis?
Brevity CSS:
.container {
position: absolute;
overflow-y: scroll;
height: 400px;
width: 200px;
border: 1px solid green;
.element {
height: 100px;
padding: 10px;
position: relative;
margin-top: 10px;
&::after {
content: '';
position: absolute;
top: -20px;
left: -30px;
width: 50px;
height: 20px;
border: 1px solid black;
background: white;
}
}
}