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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


	<!-- 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" />

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


🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.