背景视频未覆盖全屏 [英] background video is not covering the full screen

查看:45
本文介绍了背景视频未覆盖全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景中的视频无法全屏显示,也无法在我的手机上自动播放.

The video in the background is not covering the full screen,it's not autoplaying on my phone also.

enter code here

body video {
    height:100%;
    opacity: 0.8;
    width:auto;
    z-index: -1000;


    position: fixed;
    pointer-events: none;

    background-size:cover;
    autoplay:true;
    scroll-behavior: smooth;


}

推荐答案

您需要使用固定位置,且最小宽度为100%.看下面的例子.PS-我使用了div,因为我不知道如何在SO上上传视频,但是它可以在视频上使用.

You need to use a fixed position, and a min-width of 100%. Look at the example below. PS - I used a div, because I don't know how to upload a video on SO, but it works on videos.

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%; 
  min-height: 100%;
  background:red;
}

<div id = "myVideo"></div>

这篇关于背景视频未覆盖全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆