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 includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.


                <body class="dark-theme">

    <div class="video-background">

        <div class="video-foreground">

            <iframe src="" frameborder="0" allowfullscreen tabindex="-1"></iframe>

            <h1 class="knockout-text">glide</h1>



    <button class="theme-btn">Switch to <span class="theme-type">Light</span> Theme</button>

    <!-- External JavaScript File -->
    <script src="/js/main.js"></script>



                * {
	box-sizing: border-box;

body {
	font-family: Arial, sans-serif;
    height: 100vh;
	overflow: hidden;

/* Video */

.video-background {
  background: url( no-repeat center;
  background-size: cover;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
.video-background iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;

@media (min-aspect-ratio: 16/9) {
  .video-foreground {
	  height: 300%;
	  top: -100%;

@media (max-aspect-ratio: 16/9) {
  .video-foreground {
	  width: 300%;
	  left: -100%;

/* Knockout Text */

.knockout-text {
	position: absolute;
	top: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
    font-size: calc(10px + 13vw + 2.5vh);
	font-weight: 900;
	letter-spacing: 0.15em;
    margin: auto;
	text-transform: uppercase;
	user-select: none;
    -webkit-text-stroke-color: #9f9f9f;
	-webkit-text-stroke-width: 0.015em;	

.light-theme .knockout-text {
	background-color: #fff;
    color: #000;
    mix-blend-mode: screen;

.dark-theme .knockout-text {
	background-color: #000;
    color: #fff;
    mix-blend-mode: multiply;

/* Change Theme Button */

.theme-btn {
	position: absolute;
	top: 1em;
	left: 1em;
	font-family: inherit;
	font-size: calc(15px + 0.1vw + 0.5vh);
	border-width: 0.15em;
	border-style: solid;
	border-radius: 0.8em;
	background-color: transparent;
	margin: 0 auto;
	padding: 0.8em 1.2em;
	cursor: pointer;
	outline: none;
	white-space: nowrap;
	user-select: none;

.light-theme .theme-btn {
	color: #1a1a1a;
	border-color: #1a1a1a;

.dark-theme .theme-btn {
	color: #eee;
	border-color: #eee;



                //JavaScript to switch theme classes only

//DOM load event
window.addEventListener("DOMContentLoaded",	() => {

    const themeButton = document.querySelector('.theme-btn'),
          themeType = document.querySelector('.theme-type');

    themeButton.addEventListener('click', () => {

        //Apply theme
        if (document.body.classList.contains('light-theme')) {

            //Remove light theme

            //Add dark theme

            //Set button text
            themeType.textContent = 'Light';

        } else {

            //Remove dark theme

            //Add light theme

            //Set button text
            themeType.textContent = 'Dark';