Jump to content

Background Image with Custom Code for Mobile

Recommended Posts

Hi there, 

 

I've had to manipulate css to change/overlay the background image of the landing page for the mobile version. But now all my other pages like the contact and the terms & condition pages have the same background image as well. I only specifically want it on the landing page for the mobile.. 

 

this is the code i've used: 

 

 @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/63dc0265b9acba3f7f59581b/t/63e29a7b4365543e02b93375/1675795070170/MobileBackground.png);
background-size: 100%;
background-position: center;
background-repeat: no-repeat;
   }
}

 

I also want to swap out an image of an image block so that the image on the desktop is a different one than the one on the mobile. Any ideas of how to accomplish that? 

 

 

Thank you, 

 

Jenny!

Screen Shot 2023-02-09 at 3.37.33 PM.png

Screen Shot 2023-02-09 at 3.37.46 PM.png

Edited by JennyWittor
spelling mistake
Link to comment
  • JennyWittor changed the title to Background Image with Custom Code for Mobile
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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.