Jump to content

Replacing Background video with an image on mobile

Go to solution Solved by Lesum,

Recommended Posts

Hi!

I have a background video for my hero section on my website. I would like to replace that video with a fixed image for the mobile layout and can't seem to find a way to do that so that's why I'm reaching out to the community!
 

I would like to be able to resize the text on this hero section for the mobile layout as well.

Thank you in advance for any help you can bring me 🙂

Link to comment

@Mofoxdesign You can add this code in Website > Pages > Website Tools > Custom CSS

@media screen and (max-width:767px) {
	section[data-section-id="66967f6c4958591ff334c52c"] {
		.section-background video {
    		opacity: 0 !important;
		}
		.section-background img {
    		opacity: 1 !important;
		}
	}
}

 

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

Link to comment
  • Solution

@Mofoxdesign Sure thing! You can update the previous code I shared to the following:

@media screen and (max-width: 767px) {
    section[data-section-id="66967f6c4958591ff334c52c"] .section-background video {
        opacity:0 !important
    }

    section[data-section-id="66967f6c4958591ff334c52c"] .section-background img {
        opacity: 0 !important
    }
    section[data-section-id="66967f6c4958591ff334c52c"] .section-background {
        background-image: url("your-image-url");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
}

 

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

Link to comment
  • 3 weeks later...

Hi there,

Im having this same issue.  I copied and pasted that code and found the URL for the image I'd like to use on mobile but unfortunately, nothing has changed.   I also tried with the first set of code for the set fallback image and that didn't work as well.  Would there be a setting/button i'm missing to make this work?  Thank you! 

Link to comment
On 8/8/2024 at 4:05 AM, Mustberoz said:

Hi there,

Im having this same issue.  I copied and pasted that code and found the URL for the image I'd like to use on mobile but unfortunately, nothing has changed.   I also tried with the first set of code for the set fallback image and that didn't work as well.  Would there be a setting/button i'm missing to make this work?  Thank you! 

You need to change ID in the code. You can use this below tool.

image.thumb.png.8d02413bf49ac4e1be4f92534eaf7fcc.png

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a 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.