Skip to content

Instantly share code, notes, and snippets.

@pauloiankoski
Created August 7, 2015 02:41
Show Gist options
  • Save pauloiankoski/8400e566703707b828c9 to your computer and use it in GitHub Desktop.
Save pauloiankoski/8400e566703707b828c9 to your computer and use it in GitHub Desktop.
Video background
<?php
if ( is_front_page() ) :
?>
<div class="video-container">
<video autoplay loop poster="polina.jpg">
<source src="<?php vulcano_images( 'bg-video.webm' ); ?>" type="video/webm">
<source src="<?php vulcano_images( 'bg-video.mp4' ); ?>" type="video/mp4">
</video>
</div>
<?php
endif;
?>
.video-container {
background : url(../images/bg-home.jpg) no-repeat center center / cover;
height : 680px;
left : 0;
overflow : hidden;
position : absolute;
right : 0;
top : 0;
width : 100%;
z-index : -100;
&::after {
background : url(../images/overlay-video.png) repeat left top;
bottom : 0;
content : ' ';
height : 100%;
left : 0;
position : absolute;
right : 0;
top : 0;
width : 100%;
z-index : 2;
}
video {
height : auto;
left : 50%;
min-height : 100%;
min-width : 100%;
position : absolute;
top : 50%;
transform : translateX(-50%) translateY(-50%);
width : auto;
z-index : 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment