YouTube my way

Mikael Magnusson
I am a developer
Published in
1 min readNov 2, 2015

There are some thing you can do to style the embedded YouTube-player. And you can also stretch the embed to fit your needs.

Style

For styling, please see the YouTube Embedded Players and Player Parameters page. And for some examples, see this blog post. Below code from that post:

<iframe width="560" height="349" src="http://www.youtube.com/embed/9h1swNWgP8Q?theme=light&color=red" frameborder="0" allowfullscreen></iframe>

Stretch

Some javascript magic will make your embed videos always stretch to the width of the enclosing div (or whatever you specify). See this code snippet:

I use this on this site (check any posts with YouTube videos).

(Originally published 2013–04–17)

--

--