Can a YouTube video that is embedde...

User 1981050 Photo


Registered User
96 posts

I've got my new photography website designed and am in the process of making it responsive and have a quick question. On my front page I've got a YouTube video embedded and am trying to figure if I can make it responsive. It is 800px wide and 605px high in the HTML. It actually looks good in all sizes except for the 482px (smartphone) size. At that size it is too wide for the screen. I've tried changing the sizes in the HTML, changing the max width in the design panel and neither works. Changing the size in the HTML changes is across the spectrum of sizes making the video too small at the larger sizes.
I've added some screenshots to show what I'm trying to do.

Is it possible to make this responsive and if so how?

Thanks for any help,

Linda
User 187934 Photo


Senior Advisor
20,190 posts

This toot is for RLM, but the code and basic principles are the same.
http://www.coffeecup.com/help/articles/ … out-maker/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 187934 Photo


Senior Advisor
20,190 posts

So you use this code
<div class="video-container"><iframe width="800" height="605" src="https://www.youtube.com/embed/myyoutubevideocode" frameborder="0" allowfullscreen></iframe></div>

Then add this to your custom-style.css
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height:0;
overflow: hidden;
}
.video-container iframe {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 1981050 Photo


Registered User
96 posts

Thanks Eric,

When I copied and pasted the first set of code it would not show the video on preview. So, I changed the code between video-container"> and <div/> to my original code and that showed the video again. Did I do that right? And where do I put the second box of code? If I add it to the first in the html box it stays white and shows up under the video box as text in the preview.

As you can probably tell I know next to nothing about code.

Thanks again,

Linda
User 187934 Photo


Senior Advisor
20,190 posts

In my code you needed to adjust the myyoutubevideocode
src="https://www.youtube.com/embed/myyoutubevideocode"
to match yours since I don't know what yours is.
The second piece of code should be placed in a custom-style.css page and a link to that page be placed in the head of the page with the video.
Here's how can setup your css style sheet link.
<link rel="stylesheet" href="http://mydomain.com/css-custom/custom.css">

Adjust the
http://mydomain.com
to your actual domain name.
Create that sheet using a html editor and upload it to your site inside a folder named css-custom.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 1981050 Photo


Registered User
96 posts

Thanks Eric,

Sorry I was so slow responding we had a job that took precedence and I'm just getting back. Thank you so much for explaining this in detail. I think I've got it now.

Linda

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.