Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

mrx3
8,742 PointsCan someone help me find a good site that explains how to make a YouTube video resize with the browser window.
I need some help finding a good example of how to make a YouTube video that's embedded resize with he browser window. Thanks in advance for any help.
5 Answers

Joshua Briley
Courses Plus Student 24,645 PointsThis technique has worked well for me in the past: http://avexdesigns.com/responsive-youtube-embed/

Kevin Naegele
10,868 PointsHave you tried changing the px's into em's?

Joshua Briley
Courses Plus Student 24,645 PointsAwesome! I'd love to see it when you're done. Please be sure to share it with us!

mrx3
8,742 PointsDude I would love to. I've put it one my Xampp Apache server to test it out, and it looks good in all three browsers. I don't have a web hosting company yet. Also, I've used three pictures that relate to the movie for each movie page, and I'm sure there's copyright issues. I've even went as far as to make sure each picture resizes with the browser window for mobile phones.

mrx3
8,742 PointsAnd here is my css:
.video-wrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.video-wrapper iframe{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

Joshua Briley
Courses Plus Student 24,645 PointsLooks good to me: http://codepen.io/somecallmejosh/pen/BDnfu

Joshua Briley
Courses Plus Student 24,645 PointsAnd excellent choice of movie! ;-)

mrx3
8,742 PointsThanks Joshua much appreciated. I'm making a practice site called my favorite movies. Scarface, Goodfellas, Casino, The Empire Strikes Back, and Alien. I'm watching Scarface now, I'm at the part, "Maybe you can handle yourself one of those one way tickets to the resurrection." :D
mrx3
8,742 Pointsmrx3
8,742 PointsThanks for the comments guys. Here's what if have, and Joshua it almost looks like yours. Let me know what you think. HTML below: