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.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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.

+ add another resource


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.



	<!-- Video from -->
	<video class="video-bg" autoplay muted loop>
		<source src="" type="video/mp4" />
		<source src="" type="video/webm" />

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



	<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>



                :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.2em 0.5em rgba(0, 0, 0, 0.5);

.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;




Full-page view: