cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <header>

	<!-- Video from coverr.co -->
	<video class="video-bg" autoplay muted loop>
		<source src="http://www.georgewpark.com/video/blurred-street.mp4" type="video/mp4" />
		<source src="http://www.georgewpark.com/video/blurred-street.webm" type="video/webm" />
	</video>

	<div class="video-overlay">
		<h1>Full-Screen Background Video <br>Using CSS Grid &amp; object-fit</h1>
	</div>

</header>

<main>

	<h2>Lorem Ipsum</h2>

	<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo dolorum totam dicta quidem eaque quos neque, dolor numquam itaque placeat! Id quia at officia, accusamus placeat vero sed ea quo voluptates. Earum praesentium saepe maxime, esse veniam aperiam,
		officiis beatae error voluptatem odit provident optio vel eum nemo, facilis numquam fugit laboriosam. Libero veritatis repellendus quo. Facere perferendis blanditiis, voluptates cupiditate veniam repudiandae cumque sit provident nobis, beatae aut aliquam
		dolorem qui porro repellendus totam animi delectus laudantium.</p>

</main>
            
          
!
            
              @import url("https://fonts.googleapis.com/css?family=Montserrat:400,600,700");

:root {
	/* Base font size */
	font-size: 10px;

	/* Full grid area variable */
	--fullGrid: 1 / 1 / -1 / -1;
}

body {
	font-family: "Montserrat", Arial, sans-serif;
	background-color: #fcfcfc;
}

header {
	/* Create grid spanning viewport width & height */
	display: grid;
	grid-template-rows: 100vh;
	overflow: hidden;
	box-shadow: 0 0.5em 0.5em rgba(0, 0, 0, 0.7);
}

.video-bg {
	/* Span the full grid */
	grid-area: var(--fullGrid);

	/* Re-size video to cover full screen while maintaining aspect ratio */
	min-width: 100%;
	min-height: 100%;
	object-fit: cover;

	/* Display video below overlay */
	z-index: -1;
}

.video-bg::-webkit-media-controls {
	display: none !important;
}

.video-overlay {
	/* Span the full grid */
	grid-area: var(--fullGrid);

	/* Center Content */
	display: grid;
	justify-content: center;
	align-content: center;
	text-align: center;

	/* Semi-transparent background */
	background-color: rgba(0, 0, 0, 0.55);
}

h1 {
	font-size: calc(1.8em + 2.5vw);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: #fff;
	text-shadow: 0.05em 0.05em 0.05em rgba(0, 0, 0, 0.4);
}

main {
	padding: 5em 2em;
	max-width: 94em;
	margin: 0 auto;
}

h2 {
	font-size: calc(3em + 0.2vw);
	font-weight: 600;
	text-align: center;
	margin: 1.2em 0;
	color: #111;
}

p {
	font-size: calc(2em + 0.2vw);
	font-weight: 400;
	line-height: 2;
	color: #222;
}

::-moz-selection {
	background-color: rgba(0, 0, 0, 0.75);
	color: #fff;
}

::selection {
	background-color: rgba(0, 0, 0, 0.75);
	color: #fff;
}

            
          
!
999px
Loading ..................

Console