Ways to set up a video as a background 'image'

后端 未结 3 1007

I need to set up a website with a video as the background.

Will I be able to use z-index to position other elements on top of the video? Is there a bet

相关标签:
3条回答
  • 2020-12-30 12:31

    If you are using flash as your video playing method no - flash is ALWAYS on top of anything regardless of z-index, But I imagine this could be done by using the new HTML5 <video> tag.

    Failing that convert to a high-frame rate animated image and set as BG...

    0 讨论(0)
  • 2020-12-30 12:40

    I have not tested it, but you could try to set width/height of <video> to 100% then using z-index let all the others element stay on top of it...

    Edit: for example to set video as background entire page

    <body style="height: 100%;width: 100%">
    <div style="position: fixed; top: 0; width: 100%; height: 100%; z-index: -1;">
     <video src="" width="100%" height="100%" autoplay>
     Your browser does not support the video tag.
     </video>
    </div>
    ... rest of your site
    
    0 讨论(0)
  • 2020-12-30 12:45

    You can not apply it as a CSS background (background property). You can give the effect though using layers which is controlled via the z-index property.

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