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

CSS

Shams Nelson
Shams Nelson
2,888 Points

Is this the fastest (in terms of not heavy on the browser) method to make youtube video change size responsively?

It's a little slow to catch up when I resize my browser, but who really does that very often i guess...

Would it be better to use @media queries?

I'm also thinking about viewing on a mobile. Will this responsive code be fine to resize to mobile?

2 Answers

Shams Nelson
Shams Nelson
2,888 Points

Thanks Michael. This looks clean and simple. Hoping it wont lag too much with 10+ videos on a page.... Only one way to find out.

Shams Nelson
Shams Nelson
2,888 Points

Oh. I want the youtube video to shrink to fit the size of the browser width.

So say the browser is 1000px wide then the video will be 900px wide (having 50px margins), but if the browser is 700px wide, then the video will be 600px wide.

So the video size changes to fit the browser size. Does that make sense?