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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget 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

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.