Jump to content

How do I make a video responsive to different screen sizes?

Recommended Posts

Here is a link to the webpage I'm working on:

https://www.natashajohnux.com/collect

I added a code block and put in the following code for the video playing at the top of the webpage: 

<video autoplay="autoplay" loop="true" width="770">
<source src="https://static1.squarespace.com/static/620b3aebd5c003030aac6739/t/6389718de488386b64bbffbd/1669951885933/for+portfolio.mp4
" type="video/mp4"/>  
</video>

How do I change the code to make it responsive to different screen sizes? Thanks!

Link to comment
  • Replies 7
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

9 hours ago, natashaj said:

Here is a link to the webpage I'm working on:

https://www.natashajohnux.com/collect

I added a code block and put in the following code for the video playing at the top of the webpage: 

<video autoplay="autoplay" loop="true" width="770">
<source src="https://static1.squarespace.com/static/620b3aebd5c003030aac6739/t/6389718de488386b64bbffbd/1669951885933/for+portfolio.mp4
" type="video/mp4"/>  
</video>

How do I change the code to make it responsive to different screen sizes? Thanks!

So you mean this image? I can not see any video on this page

image.thumb.png.aa6808bfe44aff324a4be34642638d23.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
18 hours ago, natashaj said:

Yes it's that image! I set it to a video that autoplays...is it not showing up as a video on your end?

You can try the following code to fix the right width on mobile

@media only screen and (max-width: 767px) {
  .sqs-block-code video {
    width: 100%;
  }
}

Just a comment that you video does not run on my end

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
13 hours ago, Beyondspace said:

You can try the following code to fix the right width on mobile

@media only screen and (max-width: 767px) {
  .sqs-block-code video {
    width: 100%;
  }
}

Just a comment that you video does not run on my end

I tried this and it didn't work. I forgot to mention I used HTML to code my video

Edited by natashaj
Link to comment
On 12/31/2022 at 4:07 AM, natashaj said:

Yes it's that image! I set it to a video that autoplays...is it not showing up as a video on your end?

It doesn't autoplay here. To set autoplay, change your code to this

<video autoplay loop width="770px">
<source src="https://static1.squarespace.com/static/620b3aebd5c003030aac6739/t/6389718de488386b64bbffbd/1669951885933/for+portfolio.mp4" type="video/mp4"> 
</video>

Reference: https://www.w3schools.com/tags/tag_video.asp

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
On 1/1/2023 at 6:40 PM, tuanphan said:

It doesn't autoplay here. To set autoplay, change your code to this

<video autoplay loop width="770px">
<source src="https://static1.squarespace.com/static/620b3aebd5c003030aac6739/t/6389718de488386b64bbffbd/1669951885933/for+portfolio.mp4" type="video/mp4"> 
</video>

Reference: https://www.w3schools.com/tags/tag_video.asp

Thank you!

Do you know how I can change my code to make it responsive to different screen sizes?

Link to comment
On 1/4/2023 at 1:39 AM, natashaj said:

Thank you!

Do you know how I can change my code to make it responsive to different screen sizes?

Try adding to Design > Custom CSS

@media screen and (max-width:991px) {
video {
    width: 100% !important;
}
}

 

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.