CSS-Tricks PSD to HTML

Spice Up Embedded YouTube Videos with Background CSS

If you are adding video to your website, using embedded YouTube videos is definitely something to consider. In addition to saving hugely on bandwidth, releasing your video into the wild on YouTube might gain you some exposure you may have not otherwise gotten. One drawback is that you don’t have very much control of how this video gets displayed. Basically you get the simple YouTube player:

embeddedyoutube1.png

You don’t have control over much, including quality and the “related videos” that YouTube will show once the movie is done playing. What you do have control over, is how and where this video gets embedded. To spice things up a bit, you could design a backdrop for the video, set it as a background-image of a div, and embed the video in that div. Check it:

embeddedyoutube2.png

[LIVE EXAMPLE]

[DOWNLOAD EXAMPLE]


Theoretically Related Articles:

Discussion Elsewhere


Responses


  1. 1

    Gravatar

    I tried your tip for displaying a youtube video. I have the following issue where the video will display over the background image even though I want it to be hidden as if it were a real video being played. I tried z-indexing but that did not work. Do you have any ideas?

    Link: http://www.myspace.com/styleplus1

    You may contact me at daortezATgmail.com


    Comment by David — March 12, 2008 @ 10:41 pm

  2. 2

    Gravatar

    @David: Looks pretty good to me… did you fix the problem or am I just not understanding your question?


    Comment by Chris Coyier — March 13, 2008 @ 12:02 pm

  3. 3

    Gravatar

    Chris: I wanted to make it full screen but the best I can do is the current version with about a 10% gap that is empty. Thanks for the inspiration nonetheless.


    Comment by David — March 13, 2008 @ 12:09 pm

  4. 4

    Gravatar

    Can you just change your background image to be narrower vertically to hide that gap?


    Comment by Chris Coyier — March 13, 2008 @ 1:46 pm


Leave a comment

Sick of typing in all this info everytime you comment? Register or Login and save yourself time!

Live Comment Preview


Thank you for visiting CSS-Tricks! I'm glad you found an article useful enough to print out! Remember to visit css-tricks.com often for more fresh content.