Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS transform and YouTube embeds

Using css-transforms on a YouTube embed renders the video black in at least Safari 5 and Firefox 4. Chrome 11 handles it just fine.

I've made an example here: http://jsfiddle.net/oskarrough/4vRzd/4/

I need the css-transform in order to do some fancy layout positioning. Is there any way, css or js, to hack it to display the video?

like image 962
0skar Avatar asked Apr 15 '11 10:04

0skar


2 Answers

I am tackling the same problem right now. I am not doing any fancy css transformations, just scaling.

Although not working perfectly, I got the video to display by using the wmode=transparent option.

i.e.

<iframe width='640' height='480' frameborder='0' src='http://www.youtube.com/embed/YOUTUBE_VIDEO_ID?wmode=transparent' type='text/html' class='youtube-player'></iframe>
like image 115
lawrenceshen Avatar answered Oct 23 '22 17:10

lawrenceshen


Are you sure you can't use this instead:

iframe {
    position: relative;
    top: 100px
}

http://jsfiddle.net/4vRzd/5/

Or margin-top: 100px, or a negative margin on some other element?

Someone had to post this, because you didn't mention that they aren't viable options.

like image 43
thirtydot Avatar answered Oct 23 '22 18:10

thirtydot