<!DOCTYPE html>
<htmlxmlns="http://www.w3.org/1999/xhtml"> <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>无标题文档</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        html,
        body {
            height: 100%;
            width: 100%;
        }

        .index {
            height: 100%;
            position: relative;
            width: 100%;
        }

        .contain {
            width: 100%;
            height: 100%;
            position: relative;
            overflow: hidden;
        }

        video {
            display: block;
            min-height: 100%;
            min-width: 100%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    </style>
    </head>

    <body>

        <div class="index">
            <div class="contain">
                <!-- muted 属性属于逻辑属性,当设置该属性后,它规定视频的音频输出应该被静音 -->
                <video autoplay="autoplay" loop="loop" muted="muted">
                    <source src="./top_bg.mp4" type="video/mp4">;
                </video>
            </div>
        </div>
    </body>
    <script>
    </script>

    </html>

相关文章:

  • 2022-01-09
  • 2021-12-01
  • 2021-05-18
  • 2021-08-31
  • 2021-10-06
  • 2021-07-19
猜你喜欢
  • 2022-12-23
  • 2021-08-22
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案