I apologize in advance for my English, I'm using Parallax.js on my page and I ran into the following problem. The picture that I use to create the parallax has a resolution of 3160x2840 but my screen is 1920x1080. Is it possible to make this photo scale to the screen resolution?
Asked
Active
Viewed 111 times
1 Answers
0
here is a trick, specify class="parallax-image" to your img tag
.parallax-image {
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
other way you can use
width: 100vw

Nabeel Sajid
- 193
- 6
-
it doesn't change anything, it looks like it's being ignored – idk May 25 '21 at 11:25
-
you can use width: 100vw height: 100vw but it is not recommended – Nabeel Sajid May 25 '21 at 11:32