Skip to content

Instantly share code, notes, and snippets.

@rsgranne
Created December 15, 2018 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsgranne/32aa630e0d17ac5c59001c68c739cf43 to your computer and use it in GitHub Desktop.
Save rsgranne/32aa630e0d17ac5c59001c68c739cf43 to your computer and use it in GitHub Desktop.
Bootstrap 4 Jumbotron Video
.jumbotron-video {
/* must set this so we can use position: absolute next */
position: relative;
/* don’t let video exceed the boundaries we set */
overflow: hidden;
/* show users more of page below the hero */
height: 80vh;
}
.jumbotron-video video {
/* ↓ take video out of flow */
position: absolute;
/* ↓ make sure video is behind content, which has z-index of 20 */
z-index: 10;
/* ↓ place video in area */
top: 0;
/* ↓ object-fit is not supported on IE */
object-fit: cover;
/* ↓ make video fill the area */
min-width: 100%;
min-height: 100%;
/* ↓ set opacity to see text */
opacity: .6;
/* ↓ prevent browser from distorting video */
width: auto;
height: auto;
}
.jumbotron-video .container {
z-index: 20;
position: relative;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment