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

              
                <div id="app"></div>
    <a class="bear-link" href="https://twitter.com/intent/follow?screen_name=jh3yy" target="_blank" rel="noreferrer noopener">
      <svg class="w-9" viewBox="0 0 969 955" fill="none" xmlns="http://www.w3.org/2000/svg">
        <circle cx="161.191" cy="320.191" r="133.191" stroke="currentColor" stroke-width="20"></circle>
        <circle cx="806.809" cy="320.191" r="133.191" stroke="currentColor" stroke-width="20"></circle>
        <circle cx="695.019" cy="587.733" r="31.4016" fill="currentColor"></circle>
        <circle cx="272.981" cy="587.733" r="31.4016" fill="currentColor"></circle>
        <path d="M564.388 712.083C564.388 743.994 526.035 779.911 483.372 779.911C440.709 779.911 402.356 743.994 402.356 712.083C402.356 680.173 440.709 664.353 483.372 664.353C526.035 664.353 564.388 680.173 564.388 712.083Z" fill="currentColor"></path>
        <rect x="310.42" y="448.31" width="343.468" height="51.4986" fill="#FF1E1E"></rect>
        <path fill-rule="evenodd" clip-rule="evenodd" d="M745.643 288.24C815.368 344.185 854.539 432.623 854.539 511.741H614.938V454.652C614.938 433.113 597.477 415.652 575.938 415.652H388.37C366.831 415.652 349.37 433.113 349.37 454.652V511.741L110.949 511.741C110.949 432.623 150.12 344.185 219.845 288.24C289.57 232.295 384.138 200.865 482.744 200.865C581.35 200.865 675.918 232.295 745.643 288.24Z" fill="currentColor"></path>
      </svg>
    </a>
              
            
!

CSS

              
                @font-face {
  font-family: "Geist Mono";
  src: url(https://assets.codepen.io/605876/GeistMonoVariableVF.ttf);
}

*,
*::before,
*::after {
	transform-style: preserve-3d;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Geist Mono", monospace;
  background: hsl(0 0% 2%);
  color-scheme: dark only;
}

body::before {
	--line: hsl(0 0% 95% / 0.15);
	--size: 60px;
	content: "";
	height: 100vh;
	width: 100vw;
	position: fixed;
	background:
		linear-gradient(90deg, var(--line) 1px, transparent 1px var(--size)) 50% 50% / var(--size) var(--size),
		linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% / var(--size) var(--size);
	mask: linear-gradient(-15deg, transparent 30%, white);
	top: 0;
	transform-style: flat;
	pointer-events: none;
	z-index: -1;
}

button {
  font-family: "Geist Mono", monospace;
  text-transform: uppercase;
  color: canvasText;
  padding: 1rem 2rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
}

button::after {
  content: ""; 
  position: absolute;
  inset: 0;
  background: hsl(0 0% 100%);
  opacity: calc(var(--intent, 0) * 0.0875);
  transition: opacity 0.2s;
}

button:is(:hover, :focus-visible) {
  --intent: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

button > span:not(.sr-only) {
  position: relative;
  color: transparent;
}

button > span:not(.sr-only)::after {
  content: attr(data-char);
  position: absolute;
  display: inline-block;
  inset: 0;
  color: canvasText;
}

button:is(:hover, :focus-visible) > span:not(.sr-only)::after {
  animation: flash calc(var(--speed, 0.25) * 1s) calc(var(--index, 0) * 0.05s) steps(1, end);
}

@keyframes flash {
  0%, 20%   { content: '_'; }
  40%  { content: var(--char-1); }
  60%  { content: var(--char-2); }
  80%  { content: var(--char-3); }
}

[data-explode=true] button:is(:hover, :focus-visible) {
	--intent: 0;
}

[data-explode=true]:has(button:is(:hover, :focus-visible)) .dummy {
	--intent: 1;
}

[data-explode=true] #app {
	transform: translate3d(0, 0, 100vmin) rotateX(-24deg) rotateY(40deg);
}

[data-explode=true] button {
	scale: 2.4;
}

button:not(.dummy)::before {
	content: ".char ::after";
	position: absolute;
	left: 100%;
	white-space: nowrap;
	translate: 0 -50%;
	transform-origin: 0 50%;
	scale: 0.5;
	top: 50%;
	text-transform: none;
	pointer-events: none;
	opacity: 0;
}

[data-explode=true] #app {
	transition: transform 0.5s 1s;
}

[data-explode=true] button {
	transform: translate3d(0, 0, 50px);
	transition: transform 0.5s 2s, scale 0.5s 0s;
}

[data-explode=true] .dummy {
	opacity: 1;
	transform: translate3d(0, 0, -50px);
	transition: transform 0.5s 2s, scale 0.5s 0s, opacity 0s 0s;
}

[data-explode=true] button:not(.dummy)::before {
	opacity: 1;
	transition: opacity 1s 3s;
}

button:not(.dummy)::before {
	transition: opacity 0.5s 0s;
}

button {
	transition: transform 0.5s 1s, scale 0.5s 3s, opacity 0s 3s;
}

#app {
	transform: translate3d(0, 0, 100vmin) rotateX(0deg) rotateY(0deg);
	transition: transform 0.5s 2s;
}

.dummy {
	position: absolute;
	top: 50%;
	left: 50%;
	translate: -50% -50%;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	color: hsl(0 0% 100% / 0.5);
}

/* Social */
.bear-link {
	color: canvasText;
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	width: 48px;
	aspect-ratio: 1;
	display: grid;
	place-items: center;
	opacity: 0.8;
}

:where(.x-link, .bear-link):is(:hover, :focus-visible) {
	opacity: 1;
}
.bear-link svg {
	width: 75%;
}


              
            
!

JS

              
                import React from 'https://cdn.skypack.dev/react'
import { render } from 'https://cdn.skypack.dev/react-dom'
import { useTweaks } from 'https://cdn.skypack.dev/use-tweaks'

const ROOT_NODE = document.querySelector('#app')
const GLYPHS =
  'ăƒ©ăƒ‰ă‚ŻăƒȘăƒ•ăƒžăƒ©ă‚œăƒłă‚ăŸă—ăƒŻă‚żă‚·ă‚“ă‚‡ăƒłăƒ§ăŸă°ă“ă‚żăƒă‚łăšă†ăă‚‡ă†ăƒˆă‚Šă‚­ăƒ§ă‚Š0123456789±!@#$%^&*()_+ABCDEFGHIJKLMNOPQRSTUVWXYZ'
const TEXT = 'Click Me'
const App = () => {
  const { explode, speed, text } = useTweaks({
    text: { value: 'Click Me', label: 'Text' },
    speed: { value: 0.25, label: 'Speed(s)', min: 0.1, max: 5, step: 0.1 },
    explode: { value: false, label: 'Explode' },
  })

  React.useEffect(() => {
    document.body.dataset.explode = explode
  }, [explode])

  return (
    <>
      <button style={{ '--speed': speed }}>
        {text.split('').map((char, index) => {
          return (
            <span
              data-char={char}
              style={{
                '--index': index,
                '--char-1': `"${
                  GLYPHS[Math.floor(Math.random() * GLYPHS.length)]
                }"`,
                '--char-2': `"${
                  GLYPHS[Math.floor(Math.random() * GLYPHS.length)]
                }"`,
                '--char-3': `"${
                  GLYPHS[Math.floor(Math.random() * GLYPHS.length)]
                }"`,
              }}
            >
              {char}
            </span>
          )
        })}
        <span className="sr-only">{text}</span>
      </button>
      <button className="dummy">{text}</button>
    </>
  )
}

render(<App />, ROOT_NODE)

              
            
!
999px

Console