css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

              <aside id="guide"></aside>

<div id="yay"></div>

  <button id="minus">-2vmin</button><button id="plus">+2vmin</button>
  <p id="message">Full demo requires support for Web Animations API and `composite: 'add'`. Available in Firefox Nightly 59+ and Chrome Canary 65+ (with Experimental Web Platform Features flag enabled).</p>
    <p><code>transform: rotate(0deg) translateX(<span id="from">0</span>vmin)</code></p>
    <p><code>transform: rotate(2880deg) translateX(<span id="to">40</span>vmin)</code></p>

              #yay {
  border: 1vmin solid hsl(143, 55%, 55%);
  width: 5vmin;
  height: 5vmin;

html {
  font-size: 62.5%;
body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: hsl(231, 35%, 8%);
  font-family: system-ui, 'Segoe UI', -apple-system, sans-serif;
*, *::before, *::after {
  box-sizing: border-box;

aside {
  --guide: hsla(303, 85%, 55%, .4);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vmin;
  height: 2vh;
  max-height: 1.6rem;

aside::before, aside::after {
  content: '';
  position: absolute;
  top: 0;
  width: 40vmin;
  bottom: 0;
  z-index: 1;
aside::before {
  --guide: hsl(43, 85%, 55%);
  --guide-a: hsla(43, 85%, 55%, .4);
  left: 0;
    linear-gradient(to right, transparent 2.5vmin, var(--guide) 2.5vmin, var(--guide) calc(2.5vmin + .1rem), transparent calc(2.5vmin + .1rem)),
    linear-gradient(to right, transparent 7.5vmin, var(--guide) 7.5vmin, var(--guide) calc(7.5vmin + .1rem), transparent calc(7.5vmin + .1rem)),
    linear-gradient(to right, transparent 12.5vmin, var(--guide) 12.5vmin, var(--guide) calc(12.5vmin + .1rem), transparent calc(12.5vmin + .1rem)),
    linear-gradient(to right, transparent 17.5vmin, var(--guide) 17.5vmin, var(--guide) calc(17.5vmin + .1rem), transparent calc(17.5vmin + .1rem)),
    linear-gradient(to right, transparent 22.5vmin, var(--guide) 22.5vmin, var(--guide) calc(22.5vmin + .1rem), transparent calc(22.5vmin + .1rem)),
    linear-gradient(to right, transparent 27.5vmin, var(--guide) 27.5vmin, var(--guide) calc(27.5vmin + .1rem), transparent calc(27.5vmin + .1rem)),
    linear-gradient(to right, transparent 32.5vmin, var(--guide) 32.5vmin, var(--guide) calc(32.5vmin + .1rem), transparent calc(32.5vmin + .1rem)),
    linear-gradient(to right, transparent 37.5vmin, var(--guide) 37.5vmin, var(--guide) calc(37.5vmin + .1rem), transparent calc(37.5vmin + .1rem)),
    linear-gradient(to bottom, transparent 45%, var(--guide-a) 45%, var(--guide-a) 55%, transparent 55%);
aside::after {
  --guide: hsl(303, 85%, 55%);
  --guide-a: hsla(303, 85%, 55%, .4);
  right: 0;
    linear-gradient(to right, hsl(183, 85%, 55%) 0rem, hsl(183, 85%, 55%) .2rem, transparent .2rem),
    linear-gradient(to right, transparent 5vmin, var(--guide) 5vmin, var(--guide) calc(5vmin + .2rem), transparent calc(5vmin + .2rem)),
    linear-gradient(to right, transparent 10vmin, var(--guide) 10vmin, var(--guide) calc(10vmin + .2rem), transparent calc(10vmin + .2rem)),
    linear-gradient(to right, transparent 15vmin, var(--guide) 15vmin, var(--guide) calc(15vmin + .2rem), transparent calc(15vmin + .2rem)),
    linear-gradient(to right, transparent 20vmin, var(--guide) 20vmin, var(--guide) calc(20vmin + .2rem), transparent calc(20vmin + .2rem)),
    linear-gradient(to right, transparent 25vmin, var(--guide) 25vmin, var(--guide) calc(25vmin + .2rem), transparent calc(25vmin + .2rem)),
    linear-gradient(to right, transparent 30vmin, var(--guide) 30vmin, var(--guide) calc(30vmin + .2rem), transparent calc(30vmin + .2rem)),
    linear-gradient(to right, transparent 35vmin, var(--guide) 35vmin, var(--guide) calc(35vmin + .2rem), transparent calc(35vmin + .2rem)),
    linear-gradient(to right, transparent 0vmin, transparent calc(40vmin - .2rem), var(--guide) calc(40vmin - .2rem), var(--guide) 40vmin, transparent 40vmin),
    linear-gradient(to bottom, transparent 45%, var(--guide-a) 45%, var(--guide-a) 55%, transparent 55%);

footer {
  position: absolute;
  bottom: 1rem;
  font-size: 1.2rem;
  color: white;
  text-align: center;
  left: 0;
  right: 0;
  font-size: 1.2rem;
footer p {
  margin: .8rem 0;
  line-height: 1.35;
footer div {
  overflow-x: auto;
  white-space: nowrap;
code {
  font-size: 1.4rem;
  font-family: monospace;

button {
  display: none;
.supports-composite-add button {
  display: inline-block;
  margin: .5rem;
  padding: .6rem 1rem;
.supports-composite-add #message {
  display: none;
              const yay = document.getElementById('yay');

const minusButton = document.getElementById('minus');
const plusButton = document.getElementById('plus');

if (yay.animate) {
  var animation = yay.animate([
    { transform: 'rotate(0deg) translateX(0vmin)'},
    { transform: 'rotate(2880deg) translateX(40vmin)'}
  ], {
    iterations: Infinity,
    duration: 10000,
    easing: 'ease-in-out',
    direction: 'alternate',
    composite: 'add'
  if (animation.effect && animation.effect.composite === 'add') {
    plusButton.addEventListener('click',e => addTranslateX(delta));
    minusButton.addEventListener('click',e => addTranslateX(-delta));

const originalRadius = 40;
let radius = originalRadius;
var delta = 2;

function addTranslateX(amount){
  radius = radius + amount;
    { transform: 'translateX(0vmin)'},
    { transform: `translateX(${amount}vmin)`}
  ], {
    iterations: 1,
    duration: 1000,
    easing: 'ease-in-out',
    fill: 'forwards',
    composite: 'add'


const guide = document.getElementById('guide');
const from = document.getElementById('from');
const to = document.getElementById('to');

function updateReference() {
    { width: `${radius * 2}vmin`}
  ], {
    iterations: 1,
    duration: 1000,
    easing: 'ease-in-out',
    fill: 'forwards'

  from.textContent = radius - originalRadius;
  to.textContent = radius;
  if (radius <= 0) {
    minus.setAttribute('disabled', 'disabled');
  } else {

🕑 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.
Loading ..................