Yes this is not exactly what I want, it is making the image to be stretched.
Basically I want the image to be full on it’s dimensions, when the screen is on the same size, and gets shrinked on the sides when the screen gets smaller.
That’s the same as the code I gave you except it’s not attached to the viewport ? The basics are the same.
The background-size: cover (which I I suggested to you) makes the image maintain its aspect ratio and will increase both width and height uniformly until the image covers the area required.
This effectively means one or other dimension will be cropped at some point unless the area is exactly the same aspect ratio as the image.
It’s not stretching the image, it’s maintains the aspect ratio the same as the code you are using. The image will shrink and enlarge uniformly with the viewport.
Yes I was doing some mistakes too with the code, it’s pretty much the same as yours and it helped me!
I just wanted to mention that I made it without the fixed background, which I thought it was necessary in the beginning and in some cases it is indeed!