I'm creating a layered parallax page that is triggered by the scrolling of the mouse. I've managed to set this up and the layers all move how I want them to. Unfortunately, I've run into a problem with the background image of the body. On the left side of the screen, there is a gap that shows the background behind it.
Gap that shows the background:
I've tried many different solutions but none of them seems to work. Any suggestions will be greatly appreciated.
here's the snippet of my HTML that involves the section with the layers
<section>
<img src="./Images/stars.png" id="stars">
<img src="./Images/moon.png" id="moon">
<img src="./Images/mountains_behind.png" id="mountains_behind">
<h2 id="text">Moon Light</h2>
<img src="./Images/mountains_front.png" id="mountains_front">
</section>
and here's a snippet of the CSS
{
margin: 0;
padding: 0;
box-sixing: border-box;
overflow-x: hidden;
scroll-behavior: smooth;
}
body {
min-height: 100vh;
overflow-x: hidden;
background: linear-gradient(#2b1055,#7597de);
}
section {
position: relative;
width: 100%;
height: 100vh;
padding: 100px;
overflow-x: hidden;
overflow-y: hidden;
display: flex;
justify-content: center;
align-items: center;
}
section img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
pointer-events: none;
}