【问题标题】:How do i make a video's height the same as my window in html如何使视频的高度与 html 中的窗口相同
【发布时间】:2021-01-01 02:58:57
【问题描述】:

我只想知道如何使视频标签与窗口高度相同。 这是我的 html 文件中的内容

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="./app.js" defer></script>
    <link rel="stylesheet" href="./style.css">
    <title>Document</title>
</head>
<body>
    <video src="example video.mp4" id="video1">
</body>
</html>

这是我的 css 文件中的内容

* {
    padding: 0px;
    margin: 0px;
}
body {
    justify-content: center;
    align-content: center;
    text-align: center;
}
#video1 {
    
}

【问题讨论】:

  • 你可以使用:height: 100vh
  • @MinalChauhan 在底部有一个很小的区域,只是白色的,有什么办法可以解决这个问题吗?

标签: html css size height


【解决方案1】:

你可以试试这个

#video1 {
     display:block;
     height:100vh;
}

【讨论】:

    【解决方案2】:

    这可能有效:

    body {
        height: 100%;
        margin: 0px;
    }
    #video1 {
        height: 100%;
    }
    

    通过强制body为全高,我们可以让里面的视频也一样高。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-26
      • 2020-01-29
      相关资源
      最近更新 更多