Need a light here, please
I wanted to make the background of my form static, while the content would scroll with the scroll bar. When I put background fixed, the background adjusts to the size of the form, it’s not what I want. I want the image to be the size of the screen, and when I scroll down the form, the background will stay the same. I saw that this effect could be something like the parallax effect, but it is not exactly the same, cause in parallax effect the background, although it seems static, moves a little. Anyway I ended up mixing the background-attachment: fixed with the parallax effect and it worked, but honestly I have no idea why. Can anyone tell me if it happened by chance or if there is any logic at it?
All of the page’s content is inside the container, the section and the .wrapped that are doing the parallax effect actually have neither the background nor the content directly inside them.
HTML:
CSS:
body {
color: black;
font-size: 16px;
font-family: Tabarra Shadow;
text-transform: uppercase;
margin: 0;
background-attachment: fixed;
background-color: (here is a very large gradient css, so I won’t put it for you)
}
.wrapped {
width: 100%;
height: 100vh;
overflow-x: hidden;
perspective: 2px;
transform-style: preserve-3d;
overflow-y: auto;
}
.section {
display: flex;
height: 100vh;
min-height: 700px;
position: relative;
transform-style: inherit;
}
.section::after {
content: " ";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
transform: translateZ(-1px) scale(1.5);
}