Bhazo Posted February 7, 2023 Share Posted February 7, 2023 I have the following code to center a background image in a section. I am trying to figure out how to prevent the image from scaling. section[data-section-id="63e1bc6bf9b9ca361148d813"]{ .section-background, .section-background .section-background-content, .section-background .section-background-canvas, .section-background .section-background-overlay { top: 0px !important; right: 0px !important; bottom: 0px !important; left: 0px !important; } } Link to comment
Ziggy Posted February 7, 2023 Share Posted February 7, 2023 What do you mean by preventing scaling? Background image tend to fill the background and crop, is that what you're wanting to prevent? What are you hoping the outcome will look like? Please like and upvote if my comments were helpful to you. Cheers! Zygmunt Spray Squarespace Website Designer Contact me: https://squarefortytwo.com Hire me on Upwork! 🔌 Ghost Squarespace Plugins (Referral link) 📈 SEO Space (Referral link) ⬛ SquareWebsites Plugins (Referral link) 🔲 SQSP Themes (Referral link) ✨ Spark Plugin (Referral link) 🖼️ Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) ☕ Did I help? Buy me a coffee? Link to comment
Bhazo Posted February 7, 2023 Author Share Posted February 7, 2023 With CSS I would have used this code: background-image: url(../images/bk.jpg); background-repeat: no-repeat; background-position: top center; background-color:#000; padding: 0px; margin: 0px; I am trying to achieve the same thing. The image in 1920x1080 and I want it always at the top and always centered. So regardless of screen width, the image is always centered. Link to comment
Solution Bhazo Posted February 21, 2023 Author Solution Share Posted February 21, 2023 I ended up screwing with the CSS code for a few days until I found the desired effect. .header { background-image:url('insert your link to your image here'); background-repeat:no-repeat; background-position: top center; height: 225px !important; } Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment