abhishekdagarit
10/26/2016 - 12:46 AM

To make a video appear in the background of a page and to make that take the entire screen size.

To make a video appear in the background of a page and to make that take the entire screen size.

#bgvid { 
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    -ms-transform: translateX(-50%) translateY(-50%);
    -moz-transform: translateX(-50%) translateY(-50%);
    -webkit-transform: translateX(-50%) translateY(-50%);
    transform: translateX(-50%) translateY(-50%);
    background: url(polina.jpg) no-repeat;
    background-size: cover; 
}
    <!-- Video background -->
    <div class="row" id="bgvid">
      <video controls width="100%" height="100%" autoplay="autoplay" loop="loop" muted="muted">
        <source src="rain.mp4" type="video/mp4">
        Rainfall
      </video>
    </div>
    <!-- Video background ends-->