Pen Settings



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


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.


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.


                <ol id="$demo">
  <li draggable="true" style="view-transition-name: card-1">CSS</li>
  <li draggable="true" style="view-transition-name: card-2">HTML</li>
  <li draggable="true" style="view-transition-name: card-3">JS</li>
  <li draggable="true" style="view-transition-name: yes-this-keeps-animating-during-morph">
      <source srcset="" type="image/webp">
      <img src="" alt="🤯" width="125" height="125">
  <li draggable="true" style="view-transition-name: a-really-long-list-item-for-funsies">If you're gonna build a time machine into a car, why not do it with some style?</li>


                @import "" layer(design.system);
@import "" layer(;

@layer demo {
  @keyframes drop-zone {
    from { box-shadow: 0 0 0 0 var(--link) }
    to   { box-shadow: 0 0 0 25px #0000 }
  li.over {
    outline: 2px dashed var(--link);
    @media (prefers-reduced-motion: no-preference) {
      animation: drop-zone 1.5s var(--ease-out-5) infinite;
    > * {
      pointer-events: none;
  [draggable] {
    cursor: grab;
    user-select: none;
    &:active {
      cursor: grabbing;
    disguises the crossfade on the gif, 
    show the live gif always 
  ::view-transition-old(yes-this-keeps-animating-during-morph) {
    display: none;
  ::view-transition-new(yes-this-keeps-animating-during-morph) {
    animation: none;
  html {
    view-transition-name: none;

@layer {
  body {
    display: grid;
    place-content: center;
    padding: var(--size-5);
    gap: var(--size-5);
  ol {
    display: grid;
    gap: var(--size-3);
    justify-items: start;
  ol > li {
    background: var(--surface-2);
    border: 1px solid transparent;
    padding-block: var(--size-3);
    padding-inline: var(--size-4);
    border-radius: var(--radius-3);
    box-shadow: var(--shadow-4);
    @media (prefers-color-scheme: light) {
      background: white;


                const drag = {
  src:   null,
  items: $demo.querySelectorAll(':scope > li'),

function handleDrop(e) {

  if (drag.src != this) {
    if (document.startViewTransition)
      document.startViewTransition(() => 
        swapSiblings(drag.src, this))
      swapSiblings(drag.src, this)

function handleDragStart(e) {
  requestAnimationFrame(() => { = '.4'
  e.dataTransfer.setData("text/html", this.outerHTML)
  drag.src = this
  // e.dataTransfer.effectAllowed = 'move'

function handleDragOver(e) {
  // e.dataTransfer.dropEffect = 'move'

function handleDragEnter(e) {

function handleDragLeave(e) {

function handleDragEnd(e) { = '1'

  drag.items.forEach(item => {

function swapSiblings(sib1, sib2) {
  let p1 = sib1.previousSibling
  let p2 = sib2.previousSibling


drag.items.forEach(item => {
  item.addEventListener('dragstart', handleDragStart, false)
  item.addEventListener('dragenter', handleDragEnter, false)
  item.addEventListener('dragover', handleDragOver, false)
  item.addEventListener('dragleave', handleDragLeave, false)
  item.addEventListener('drop', handleDrop, false)
  item.addEventListener('dragend', handleDragEnd, false)