Jump to content

Change background on mobile for one page only

Recommended Posts

Posted

Hi! Trying to change the background on the mobile version of the site for section 1 only to a different image better suited for mobile. 

 

I used the following in the CSS code, and it worked, but for every page on the site whereas I only need it on the home page. 

 

When I added it to the page header code injection for the specific page it did make any changes at all. 

 

@media only screen and (max-width: 640px)

{

#page .page-section:nth-child(1) .section-background img {opacity:0 }

#page .page-section:nth-child(1) .section-background {

background-image: url(https://static1.squarespace.com/static/636ac17575f6c9285d9ce537/t/636c3313efe57d0fa530edba/1668035358549/mobilev2.png);

background-size: cover;

background-position: center;

background-repeat: no-repeat;

}

}

  • Replies 2
  • Views 577
  • Created
  • Last Reply

Top Posters In This Topic

Posted
18 hours ago, tsphillips said:

Hi! Trying to change the background on the mobile version of the site for section 1 only to a different image better suited for mobile. 

 

I used the following in the CSS code, and it worked, but for every page on the site whereas I only need it on the home page. 

 

When I added it to the page header code injection for the specific page it did make any changes at all. 

 

@media only screen and (max-width: 640px)

{

#page .page-section:nth-child(1) .section-background img {opacity:0 }

#page .page-section:nth-child(1) .section-background {

background-image: url(https://static1.squarespace.com/static/636ac17575f6c9285d9ce537/t/636c3313efe57d0fa530edba/1668035358549/mobilev2.png);

background-size: cover;

background-position: center;

background-repeat: no-repeat;

}

}

Can you share your site with protected password so I can take a look?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - PDF Lightbox popup - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> No-code customisations for Squarespace

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.