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

              
                <!-- This is the actual demo code. -->
<section class="container basic-layout with-borders">
  <div class="glows">
    <div class="core-cloud"></div>
  </div>
</section>

<!-- This isn't part of the demo - just some controls! -->
<fieldset class="presentation-settings">
  <div class="presentation-settings--container">
    <legend>Toolbox 🧰</legend>
    <div class="presentation-settings--item">
      <input type="checkbox" id="completed-layout" name="completed-layout" data-trigger-class="basic-layout" />
      <label for="completed-layout">Show assembled layout pieces</label>
    </div>
    <div class="presentation-settings--item">
      <input type="checkbox" id="image-borders" name="image-borders" data-trigger-class="with-borders" checked />
      <label for="image-borders">Show image borders</label>
    </div>
  </div>
</fieldset>
              
            
!

CSS

              
                :root {
  --item-size: clamp(30vw, 5em, 100vw);

  background: radial-gradient(#2c2f3e, #0a0f1c);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 1rem;
  color: #efefef;
}

.container {
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
}

.glows {
  position: relative;
}

/* These are the glowing rays (before and after) */
.glows::before,
.glows::after {
  border: 2px solid transparent;
  border-radius: 6px;
  transition: border 180ms ease-out;
}

.glows::before {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: 220px;
  left: -130px;
  display: block;
  width: 405px;
  height: 397px;
  background-image: url("https://www.jpmarqu.es/assets/training/light-beam-0@2x.png");
  background-size: 405px 397px;
}
.glows::after {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: 200px;
  left: -100px;
  display: block;
  width: 415px;
  height: 531px;
  background-image: url("https://www.jpmarqu.es/assets/training/light-beam-1@2x.png");
  background-size: 415px 531px;
}

/* This is the glowing center */
.core-cloud {
  display: block;
  width: 496px;
  height: 496px;
  background-image: url("https://www.jpmarqu.es/assets/training/glow-core@2x.png");
  background-size: 496px 496px;
  background-repeat: no-repeat;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: border 180ms ease-out;
}

/* Simulate the layout without our mise-en-place */
.container.basic-layout {
  .glows {
    display: flex;
    gap: 20px;
  }

  .glows::before,
  .glows::after,
  .glows .core-cloud {
    position: relative;
    top: 0;
    left: 0;
    width: var(--item-size);
    height: var(--item-size);
    background-size: var(--item-size);
  }
}

/* Show borders on images */
.container.with-borders {
  .glows::before,
  .glows::after,
  .glows .core-cloud {
    border: 2px solid rgb(255, 255, 255, 0.4);
  }
}

/* -- Demo styles end here -- */
/* Checkbox controls styling */
.presentation-settings {
  z-index: 100;
  position: fixed;
  display: flex;
  align-items: center;
  padding: 15px;
  gap: 6px;
  bottom: 10px;
  left: 10px;
  width: calc(100vw - 50px);
  max-width: 280px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 4px 2px rgba(255, 255, 255, 0.033),
    inset 0 6px 10px 3px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(8px) saturate(150%);
  transform: translate3d(0, 0, 1px);
}

.presentation-settings--container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.presentation-settings legend {
  font-weight: bold;
  margin-bottom: 6px;
}

.presentation-settings--item {
  display: flex;
  gap: 4px;
  align-items: center;
}

              
            
!

JS

              
                /* This JS only controls the checkbox - the animation we're doing doesn't require any JS ;-) */
const animContainer = document.querySelector(".container");
const checkboxes = document.querySelectorAll(
  '.presentation-settings input[type="checkbox"]'
);

checkboxes.forEach((checkbox) => {
  checkbox.addEventListener("click", (e) => {
    animContainer.classList.toggle(e.target.dataset.triggerClass);
  });
})


              
            
!
999px

Console