Advertisement
metalx1000

HTML Full Screen background video with CSS

Apr 13th, 2017
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 2.56 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <title>Video!!!</title>
  5.   <meta charset="utf-8">
  6.   <meta name="viewport" content="width=device-width, initial-scale=1">
  7.   <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Bowlby+One+SC" />
  8.  
  9.   <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  10.   <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  11.   <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  12.  
  13.  
  14.   <!-- Compiled and minified CSS -->
  15.   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css">
  16.  
  17.   <!-- Compiled and minified JavaScript -->
  18.   <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/js/materialize.min.js"></script>
  19.          
  20.  
  21.   <style>
  22.     body, html, .videoContainer{
  23.       margin: 0;
  24.       padding: 0;
  25.     }
  26.  
  27.     .videoContainer {
  28.       position: fixed;
  29.       top: 0px;
  30.       height:100%;
  31.       width: 100%;
  32.       z-index: -100;
  33.     }
  34.  
  35.     video {
  36.       position: absolute;
  37.       top: 50%;
  38.       left: 50%;
  39.       transform: translate(-50%,-50%);
  40.       min-width: 100%;
  41.       min-height: 100%;
  42.       width: auto;
  43.       height: auto;
  44.       overflow: hidden;
  45.       z-index: -100;
  46.     }
  47.  
  48.     .overlay{
  49.       position: absolute;
  50.       top: 40%;
  51.       left: 0;
  52.       width: 100%;
  53.       color: white;
  54.       font-family: "Bowlby One SC";
  55.     }
  56.  
  57.     .info {
  58.       position: relative;
  59.       top:10px;
  60.       left:10px;
  61.     }
  62.   </style>
  63.  
  64.   <script>
  65.     $(document).ready(function(){
  66.       $('.modal').modal();
  67.     });
  68.   </script>
  69. </head>
  70. <body>
  71.   <!-- Modal Trigger -->
  72.   <a class="info waves-effect waves-light btn" href="#modal1">Information</a>
  73.  
  74.   <!--Text overlay-->
  75.       <div class="overlay text-center">
  76.         <h1>Hello World!</h1>
  77.       </div>
  78.  
  79.   <!--Video-->
  80.   <div class="videoContainer">
  81.     <video autoplay="true" loop>
  82.       <source src="video.mp4" type="video/mp4">
  83.       <source src="video.webm" type="video/webm">
  84.     </video>
  85.   </div>
  86.  
  87.   <!-- Modal Structure -->
  88.   <div id="modal1" class="modal bottom-sheet">
  89.     <div class="modal-content">
  90.       <h4>Information</h4>
  91.       <p>This is an example of a Fullscreen Video in HTML created by Kris Occhipinti of <a href="https://filmsbykris.com">Films By Kris</a></p>
  92.     </div>
  93.     <div class="modal-footer">
  94.       <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">OK</a>
  95.     </div>
  96.   </div>
  97. </body>
  98. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement