How to Make Youtube Playlist embed responsive?

Hi guys,

I'm embedding a youtube playlist into an embed code box on my weebly site. However I can't make it responsive and it cuts in half when I view it on the mobile preview.

Is there any code to add to the html which will make it responsive so it can be viewed properly on a mobile?

5,942 Views
Message 1 of 5
Report
1 Best Answer
Square

Best Answer

You could try something like this:

https://www.ostraining.com/blog/coding/responsive-videos/

The only thing you'd need to do is take the CSS code from the last steps, wrap it in style tags, and add that to Settings > SEO > Header code, e.g.

<style>
	.video-responsive{
    overflow:hidden;
    padding-bottom:56.25%;
    position:relative;
    height:0;
	}
	.video-responsive iframe{
	    left:0;
	    top:0;
	    height:100%;
	    width:100%;
	    position:absolute;
	}
</style>

View Best Answer >

5,895 Views
Message 6 of 5
Report
4 REPLIES 4
Square

What code are you embedding, and on what page of your site, @laazrockit? It's usually easiest to figure out when you can see it in action.

5,916 Views
Message 6 of 5
Report

Thanks for the reply. It's the code youtube gave me to embed a playlist. I've pasted the code into an embed code box on a standard weebly page and as you can see from the screenshots below, it displays fine on desktop but is cut on a mobile.

imageimage

 Link to the page on my site: https://theclassicheavymetalvault.weebly.com/thrash-metal.html

5,907 Views
Message 6 of 5
Report
Square

Best Answer

You could try something like this:

https://www.ostraining.com/blog/coding/responsive-videos/

The only thing you'd need to do is take the CSS code from the last steps, wrap it in style tags, and add that to Settings > SEO > Header code, e.g.

<style>
	.video-responsive{
    overflow:hidden;
    padding-bottom:56.25%;
    position:relative;
    height:0;
	}
	.video-responsive iframe{
	    left:0;
	    top:0;
	    height:100%;
	    width:100%;
	    position:absolute;
	}
</style>
5,896 Views
Message 6 of 5
Report

It's worked! Thanks so much Smiley Happy

5,883 Views
Message 6 of 5
Report
This thread has been archived and locked. Please start a new thread if you would like to continue the conversation.
grz-custom-initialLetter