How do I make this Youtube Video clickable (css + z-index)?

后端 未结 1 1685
粉色の甜心
粉色の甜心 2021-01-28 11:24

I want the Youtube video to be a background wallpaper, but I still want it to be interactive. i.e. the user can pause the video by clicking on it.

Right now, I\'ve set t

相关标签:
1条回答
  • 2021-01-28 11:56

    Like you said you have to change the z-index of every child of body except the iframe.

    body > * {
    z-index : 2 !important;
    }
    
    #youtube_bg {
    z-index : 1;
    }
    

    Or you change the z-index of body and html to -1, the iframe to 0 and the content keeps at 1 or auto.

    html, body {
    z-index : -1;
    }
    #yotube_bg {
    z-index : 0;
    }
    

    For later edits of the css the second solution would be better

    0 讨论(0)
提交回复
热议问题