Design comparison
Solution retrospective
Is there any way to make the background image static when the screen is resized?
Community feedback
- @beslerpatrykPosted about 3 years ago
I agree with @Fluffy Kas about the separate stylesheet for CSS. However, I believe that removing background-position is not the answer to your problem.
From MDN-Docs: "background-position sets the initial position for each background image"
If you want the background to be static you need to get rid of the background-size property which sets the size of the element's background image.
Notice that you specified in your media query: background-size: contain;
If you get rid of it the background will remain static (the size of it won't change with the size of the window). Having it set the property to contain is actually the right thing to do though, since it makes sure that the SVG background always covers all the background.
Hope you find that helpful. Cheers!
Marked as helpful2 - @dewslysePosted about 3 years ago
Also, remember there is a separate background image for mobile devices.
Marked as helpful1 - @FluffyKasPosted about 3 years ago
Hiya, good looking solution!
Remove the background-position and it will stay static. Also, I'd suggest linking a separate stylesheet for your css, it's not really good practice having it in your html file.
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord