创建一个覆盖整个屏幕的视频容器

creating a video container that covers the whole screen

我想创建一个覆盖整个屏幕的视频容器

并且容器内的视频覆盖整个容器,不溢出表示容器自适应整个屏幕尺寸。

并做出相应的回应。

当前视频正在播放全高..我不想要那个

我希望它的高度限制在屏幕尺寸内并且没有滚动。

我的 html 代码是

<div class="video-container">
  <div class="video-wrapper">
    <video autoplay controls>
      <source src="../../assets/movies/joker.mp4" type="video/mp4" />
      Your browser does not support the video tag.
    </video>
  </div>
</div>

我的css代码是:

.video-container {
  display: block;
  max-width: 100%;
  min-width: 200px;
}
.video-wrapper {
  background: #000;
  border-radius: inherit;
  overflow: hidden;
  position: relative;
  z-index: 0;
}
.video-container video {
  border-radius: inherit;
  height: auto;
  vertical-align: middle;
  width: 100%;
}
video {
  max-width: 100%;
  object-fit: contain;
}

请帮我解决这个问题..在此先感谢。

CSS:

* {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    font-family: Arial;
    font-size: 17px;
  }

  video {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 100%; 
    height: 100%;
  }

HTML:

<body>
    <script src="./index.js"></script>
    <video autoplay controls>
        <source src="../../assets/movies/joker.mp4" type="video/mp4">
        Your browser does not support HTML5 video.
    </video>
</body>

这样的元标记有帮助:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

您需要更改宽度和高度,CSS 具有视图高度和视图宽度的可能性,因此适合屏幕。如上所述:

.video-wrapper{
height: 100vh;
width: 100vh;
}