YouTube iFrame Embed Video Problem – Hides Menus & Other Layers
If you’re here, then you’re looking for a solution to fix a display problem with your embedded YouTube iFrame video on your website. If you’re experiencing a problem with your rollover menu hiding behind the YouTube video, then give this a try.
YouTube iFrame Video Displays Over Menu
The iFrame is basically an element on your page and so is your rollover menu. There is what’s called a “z-index” that helps the browsers understand which elements to display in which order (front-to-back or back-to-front basically). If your menu is popping up behind the YouTube iFrame video, then most likely the z-index of your menu is lower than what YouTube is assigning their video player.
Sounds pretty technical & perhaps it is, but there’s an easier solution for most of you. YouTube actually provides a parameter that you can add to the embedded iFrame URL to enable transparency (e.g. put it behind your dynamic menu).
If you can copy & paste some simple code and add it within the YouTube iFrame code itself, then you should have your problem solved in no time.
How to Fix the Embedded YouTube iFrame z-index Problem
Here’s the parameter you should add to the YouTube URL in the iFrame embed code:
?wmode=transparent
Example iFrame code:
<iframe title=”YouTube video player” width=”525″ height=”325″ src=”http://www.youtube.com/embed/ucowE8dtNqM” frameborder=”0″ allowfullscreen></iframe>
Code With Fix Applied:
<iframe title=”YouTube video player” width=”525″ height=”325″ src=”http://www.youtube.com/embed/ucowE8dtNqM?wmode=transparent” frameborder=”0″ allowfullscreen></iframe>
Check Your Code Carefully
For those of you not too tech savvy, I want you to know that the above code will only work if you paste it on a clean YouTube iFrame URL – one that doesn’t have any existing parameters already.
For an iFrame URL that already has other parameters (e.g. related videos option, show in HD, etc), you need to use a slightly different parameter when you append it in the iFrame URL:
&wmode=transparent
Example iFrame code:
<iframe title=”YouTube video player” width=”525″ height=”325″ src=”http://www.youtube.com/embed/ucowE8dtNqM?rel=0&hd=1″ frameborder=”0″ allowfullscreen></iframe>
Code With Fix Applied:
<iframe title=”YouTube video player” width=”525″ height=”325″ src=”http://www.youtube.com/embed/ucowE8dtNqM?rel=0&hd=1&wmode=transparent” frameborder=”0″ allowfullscreen></iframe>
Your Final Code may also look something like this. Notice the & where the single “&” was in the previous example – they are the same thing, one is just encoded.
<iframe title=”YouTube video player” width=”525″ height=”325″ src=”http://www.youtube.com/embed/ucowE8dtNqM?rel=0&hd=1&wmode=transparent” frameborder=”0″ allowfullscreen></iframe>
A thank you is owed to Andrew @ Scorchsoft for the fix.
(Original image source: http://www.reelseo.com/youtube-iframe-html5/)
| Print article | This entry was posted by admin on April 6, 2011 at 8:26 am, and is filed under Webmaster Resources. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

about 2 years ago
Thank you! This worked. I’ve been struggling with this for several months, if not longer.
I have a widget for WP that worked for a while, but then stopped.
I’m most appreciative.
about 2 years ago
You bet Maggie.
It took me a little while to find the solution and I hope I made my post a little bit easier for everyone to find (keywords, etc.) when they are facing the same problem.
If you also appreciate the post, please “Recommend” or share the post on Facebook. Thx
about 2 years ago
Thanks so much for this tip – saved me lots of painful playing with z-index stuff that never seems to make any sense to me. Cheers.
about 1 year ago
Thanks for writing this up so clearly! I tried it and it worked perfectly right away. I also clicked the Recommend button, since I think this is important info for all web developers.
Eric
about 1 year ago
Thanks for sharing us on your Facebook profile Eric. We greatly appreciate it & are glad that the solution worked for your website!
about 1 year ago
Great tip, but not working for me on the Chrome browser, Mac OSX. See on home page:
http://www.ideagreenhouse.biz/
Dropdown “What we offer” underlays the video, even though I have the transparency mode set to:
Any insights? Looks fine in Firefox and Safari.
about 1 year ago
Sorry, comment deleted the code I include. Transparency mode set to:
/embed/F1f22V0CTjc?rel=”0&wmode=Opaque” frameborder=”0″ allowfullscreen
about 1 year ago
@Tom – As we discussed, the problem lies with the extra quotation mark in the embed URL after the rel=
The other thing was to use “transparent” instead of “opaque”.
Glad its working now!!
about 1 year ago
Thanks Cory. No doubt this helped, but I also made some changes to my site’s template to set z-index for the dropdown menu. Wish I had IE so I could test which of these fixes (or both) made the difference. But greatly appreciate the support too!
about 1 year ago
Great tip, worked like a charm – thanks! Like others, I figured it was probably a z-index issue but was incredibly glad to realise that a quick google showed a much easier fix than z index tinkerage.
about 1 year ago
Great tip – used to know how to do this on the old YouTube embed codes – great to know how to apply it to iframes.
Thanks
about 1 year ago
Thanks you very much it’s work
about 1 year ago
rare simplicity for an important needed fix. a great big thanks to you. May you get a hug from a supermodel today.
about 1 year ago
Great posting. This saved me a ton of time! Do you know how to fix this on an Android phone. The popup image here http://localhost/MyWebsite/MyFavorites_Calloway.html
ends up behind the video on Android but works fine on FireFox and IE.
about 1 year ago
Thanks so much, I was having this issue on a WordPress-based blog and I was using the WordPress Text widget to put the embedded frame. So this post was very specific to my issue and the wmode tip worked perfectly
about 1 year ago
Thank you so much ,it worked really well. I saw other articles, but they were really techie. And they didn’t mention how to fix the video when it has some parameters selected, such as HD etc.
about 1 year ago
This totally solved our problem on our website!
about 1 year ago
I love easy solutions! Thanks so much!
about 1 year ago
I’ve been stumped for months on where to begin to fix this. Did a search this morning and found your page. The fix was so easy! Thank you very much!
about 1 year ago
Thanks. Did the trick. I knew it had to to do with the wmode, but it being an iframe, I didn’t know where to begin as there was no embed code for me to mess around with.
Appreciate you posting this.
about 1 year ago
Thanks a lot……
about 1 year ago
Thanks so much. You saved my life. Cheers~
about 1 year ago
Thank you sooo much I was just about to give up before finding this fix. Excellent work!
about 1 year ago
Hey thanks a lot. You clearly simplified the code and it solved the problem.
about 1 year ago
Hi…i have a same problem on safari browser…my menu hiding behind the youtube iframe…can someone help me???
about 1 year ago
Wow thanks! This really helped my portfolio site!
about 1 year ago
Thanks!! I have been trying to play with z-index stuff and this worked sooo much better!
Works in Safari, chrome, IE, FF.. yay!
about 1 year ago
allowfullscreen will not validate
use object embed
fixes both problems
about 1 year ago
Thank you, worked great.
about 1 year ago
Sooo helpful. Thank you!
about 1 year ago
Spent several hours trying to solve that. Even in the menu developer’s forum. But only you made it clear enough for html newbies like me.
Thanks a lot
about 12 months ago
This worked perfectly! Thank you.
about 11 months ago
It’s great that there are so many additionally ways to handle behaviour for embedded youtube clips now and I was failing to get this to work on all browsers with z-index alone.
Nice one.
about 11 months ago
You are the MAN! AWESOOOOMMMEE!! Thank you so much, I have my modal-login popup and the friggin Youtube-Video kept messing with it. Additionally I have this javascript picture-enlargement and it didnt work with the clip either. Thanks to you, it finally does! Thank you thank you thank you!!!
about 10 months ago
Thank you from Ukraine.
about 10 months ago
Don’t work with IE9 : black screen.
Z-index is fixed but no see picture in video only sound.
IE is terrible
!!!!!!!
about 10 months ago
ok problem solved on IE9 in my css i deleted a overflow:auto;
and it’s ok
about 10 months ago
Lifesaver….. Thanks so much!!!
about 10 months ago
you are awesome! I was browsing the web for like 2 hours and you saved me!… thanks and more power! This site of yours is helpful and awesome!
about 10 months ago
Very helpful information. It worked right away for us! Thanks for sharing!