首页 > 解决方案 > 如何添加全宽视频标签?

问题描述

我想在div那个id是使用javascript的视频中附加全宽的视频标签。你可以帮帮我吗?

let video = document.createElement("video")
video.width = 320;
video.height = 180;
video.style.background = "black"
document.getElementById("video").append(video);
<html>
    <body style="background: lightgrey">
        <div class="container">
            <div id="video"></div>
        </div>
    </body>
</html>

标签: javascripthtmlcss

解决方案


<video width="100%" height="auto" controls>
  <source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4">
  message if vodeo does not show
</video>


推荐阅读