Jump to content

Background Image Top Center No scaling

Go to solution Solved by Bhazo,

Recommended Posts

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
  • Replies 3
  • Views 531
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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
  • 2 weeks later...
  • Solution

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

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.