Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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.

HTML

              
                <h1>Animated Mondrian</h1>
<div class="grid">
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
  <div class="cell"></div>
</div>
<div class="warning">
  <p>ℹ️ You are using Chrome but need at least version 107 to check this demo</p>
</div>
              
            
!

CSS

              
                @keyframes animate-columns {
  0% {
    grid-template-columns: 17vmin 8vmin 5vmin 7vmin 10vmin 15vmin 15vmin;
    grid-template-rows: 4vmin 9vmin 15vmin 7vmin 13vmin 8vmin 5vmin;
  }
  25% {
    grid-template-columns: 10vmin 8vmin 15vmin 5vmin 7vmin 15vmin 17vmin;
    grid-template-rows: 15vmin 4vmin 7vmin 8vmin 5vmin 13vmin 9vmin;
  }
  50% {
    grid-template-columns: 15vmin 10vmin 17vmin 5vmin 7vmin 15vmin 8vmin;
    grid-template-rows: 4vmin 9vmin 5vmin 13vmin 7vmin 8vmin 15vmin;
  }
  75% {
    grid-template-columns: 8vmin 5vmin 7vmin 15vmin 17vmin 15vmin 10vmin;
    grid-template-rows: 13vmin 4vmin 15vmin 9vmin 5vmin 7vmin 8vmin;
  }
  100% {
    grid-template-columns: 10vmin 8vmin 5vmin 7vmin 15vmin 15vmin 17vmin;
    grid-template-rows: 4vmin 15vmin 9vmin 7vmin 8vmin 5vmin 13vmin;
  }
}

.grid {
  display: grid;
  gap: 2vmin;
  padding: 2vmin;
  grid-template-columns: 17vmin 8vmin 5vmin 7vmin 10vmin 15vmin 15vmin;
  grid-template-rows: 4vmin 9vmin 15vmin 7vmin 13vmin 8vmin 5vmin;
  align-items: stretch;
  justify-items: stretch;
  background: #333;

  animation: animate-columns 30s ease-in-out infinite alternate;
}

.grid > * {
  width: 100%;
  background: rgb(0 0 0);

  --light1: #e5eeeb;
  --light2: #f2e7d5;
  --light3: #fcfde7;
  --light4: #dfe5d0;
  --light5: #e3ded9;
  --yellow1: #f2c968;
  --yellow2: #edcc6b;
  --red1: #d62d24;
  --red2: #d73630;
  --dark1: #130409;
  --dark2: #0b0205;
  --dark3: #c0bfba;
  --blue: #241785;
}

.grid > :nth-child(1n) {
  background: var(--light1);
}
.grid > :nth-child(2n) {
  background: var(--light2);
}
.grid > :nth-child(3n) {
  background: var(--yellow1);
}
.grid > :nth-child(4n) {
  background: var(--light5);
}

.grid > :nth-child(1) {
  background: var(--red1);
}
.grid > :nth-child(2) {
  grid-column: span 2;
  background: var(--light3);
}
.grid > :nth-child(5) {
  grid-column: span 2;
  grid-row: span 3;
  background: var(--yellow1);
}
.grid > :nth-child(9),
.grid > :nth-child(13) {
  grid-row: span 2;
  background: var(--yellow2);
}
.grid > :nth-child(7) {
  grid-column: span 3;
  grid-row: span 2;
  background: var(--blue);
}
.grid > :nth-child(8) {
  background: var(--dark3);
}
.grid > :nth-child(9) {
  background: var(--light5);
}
.grid > :nth-child(10) {
  grid-column: span 3;
  grid-row: span 4;
  background: var(--light1);
}
.grid > :nth-child(12),
.grid > :nth-child(17) {
  grid-row: span 2;
}
.grid > :nth-child(14),
.grid > :nth-child(6) {
  grid-row: span 3;
  background: var(--light3);
}
.grid > :nth-child(16) {
  background: var(--red2);
}
.grid > :nth-child(18) {
  background: var(--dark1);
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background: #fcfcfc;
}

body {
  display: grid;
  place-content: center;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

.warning {
  display: none;
}

              
            
!

JS

              
                const showWarningInChromiumWithNoSupport = () => {
  if (!navigator.userAgentData || !navigator.userAgentData.brands) return;

  const chromium = navigator.userAgentData.brands.filter(
    (b) => b.brand == "Chromium"
  );
  if (!chromium) return;

  if (chromium[0].version >= 107) return;
  document.querySelector(".warning").style.display = "block";
};

showWarningInChromiumWithNoSupport();

              
            
!
999px

Console