Jump to content

Make iframe embedded code block responsive

Recommended Posts

Site URL: https://www.chrisjourdian.com/music

password: Music123

I'm trying to make the iframe responsive on mobile. I've tried putting the iframe inside and div and make it resize according to the div. This is the code I used but it isn't doing anything:

 .songwhip {
    position: relative;
    height: 0;
    padding-bottom: 25%;
    overflow: hidden;
  }
  
  .songwhip iframe {
    position: absolute;
    width: 100% !important;
    height: 100%;
    top: 0;
    left: 0;
  }

Thanks in advance~!

Link to comment
6 hours ago, simkrys said:

Site URL: https://www.chrisjourdian.com/music

password: Music123

I'm trying to make the iframe responsive on mobile. I've tried putting the iframe inside and div and make it resize according to the div. This is the code I used but it isn't doing anything:


 .songwhip {
    position: relative;
    height: 0;
    padding-bottom: 25%;
    overflow: hidden;
  }
  
  .songwhip iframe {
    position: absolute;
    width: 100% !important;
    height: 100%;
    top: 0;
    left: 0;
  }

Thanks in advance~!

I noticed you used incorrect double quote for the class name 

image.png.4a0d6be4ddd6982f68cb2cbaf80b0f2e.png

Change it from <div class=”songwhip″> to <div class="songwhip">

image.png.271e93d1f7c93f30ac7fab129e424321.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. 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.