Answers for "horizontally center video in div"

CSS
0

center a video horizontally

/*option 1:this makes the video responsive*/
.videoDiv
{
    width: 70%; /*or whatever % you prefer*/
    margin: 0 auto;
    display: block;
}

/* option 2* does not make the video responsive*/

.videoDiv{
  margin:0 auto;
  display: block;
}
Posted by: Guest on August-20-2020
3

center a video horizontally

<div class="videoDiv">
  <video width="100%" controls>
    <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
    <source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
  Your browser does not support the video tag.
  </video>
</div>
Posted by: Guest on August-20-2020

Code answers related to "horizontally center video in div"

Browse Popular Code Answers by Language