On gists
Video header
CSS
CSS trick
video-header.css
Raw
#
/*
https://jsbin.com/razumivece/edit?css,output
https://jsbin.com/qejuforoba/edit?css,output
*/
header {
position: relative;
background-color: black;
height: 400px;
width: 100%;
overflow: hidden;
}
video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 0;
transform: translateX(-50%) translateY(-50%);
}
/* or */
video {
position: absolute;
height: 100%;
width: 100%;
object-fit: cover;
}