Jump to content

Replacing background image with a mobile image

Recommended Posts

Hi all

I'm trying to replace the background image in my home page hero section with a specific mobile image. The CSS code I used previously was working but for some reason it isn't anymore. 

The mobile image is displaying, but the desktop image is still visible above it (see attached)

Can anyone help? This is the code I'm currently using:


@media only screen and (max-width:767px) {
    section[data-section-id="649c497cc96191197781d2c2"] .section-background-content {
        display: none;
    }
    section[data-section-id="649c497cc96191197781d2c2"] .section-background {
        background-image: url("https://images.squarespace-cdn.com/content/649c4974564aa84f6336f070/528a0fde-ceaf-42ee-a36f-915fa2a3ed24/wag-wall-main-final-mobile.png?content-type=image%2Fpng") !important;
        background-size: cover !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
    }
}

Screenshot 2024-05-03 at 11.00.49.png

Link to comment
  • Replies 1
  • Views 277
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

3 hours ago, Waggit said:

The mobile image is displaying, but the desktop image is still visible above it (see attached)

Can anyone help? This is the code I'm currently using:

@media only screen and (max-width:767px) {
    section[data-section-id="649c497cc96191197781d2c2"] .section-background-content {
        display: none;
    }
}

Hi @Waggit can't tell without a url, but if you're still seeing the desktop image, then this line (display: none) isn't being used.

Likely the CSS selector has changed. Check that this element still exists in your site .section-background-content.

Depending on the version/your site, it could be .section-background img.

-------- > 👆 <---------- Please quote or @ me when replying, or I won't get a notification 

Melody | Squarespace Website Developer
e: melody@melodylee.tech


💻 💁‍♀️ 1-2-1 Squarespace Training session <- feeling stuck and want to learn?
👩‍💻 💁‍♀️ Customisation help <- send me your design
 Did I help? I like coffee (Thank you)

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.