Quiero agregar la etiqueta de video con ancho completo en div que id es video usando javascript. ¿Usted me podría ayudar?
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> <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>con
#video { width: 100%; height: auto; }en su css, el video siempre usará el ancho completo disponible de su padre, en este caso, de "contenedor".
Creo que es un comentario, pero no puedo comentar, así que lo publico como respuesta.
let video = document.createElement("video") video.width = 320; video.height = 180; video.style.background = "black" document.getElementById("video").append(video); #video video { width: 100% !important; } <html> <body style="background: lightgrey"> <div class="container"> <div id="video"></div> </div> </body> </html>