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.


   <h1 class="text-ring"></h1>


                :root {
  --gray-0: #f8f9fa;
  --gray-1: #f1f3f5;
  --gray-2: #e9ecef;
  --gray-3: #dee2e6;
  --gray-4: #ced4da;
  --gray-5: #adb5bd;
  --gray-6: #868e96;
  --gray-7: #495057;
  --gray-8: #343a40;
  --gray-9: #212529;
  --gray-10: #16191d;
  --gray-11: #0d0f12;
  --gray-12: #030507;
  /* Surfaces */
  --text-1: var(--gray-12);
  --text-2: var(--gray-10);
  --text-3: var(--gray-8);
  --text-4: var(--gray-7);
  --surface-1: var(--gray-0);
  --surface-2: var(--gray-1);
  --surface-3: var(--gray-2);
  --surface-4: var(--gray-3);

@media (prefers-color-scheme: dark) {
  :root {
    --text-1: var(--gray-1);
    --text-2: var(--gray-3);
    --text-3: var(--gray-5);
    --text-4: var(--gray-6);
    --surface-1: var(--gray-10);
    --surface-2: var(--gray-9);
    --surface-3: var(--gray-8);
    --surface-4: var(--gray-7);

*:before {
  box-sizing: border-box;

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  font-family: 'Google Sans', sans-serif, system-ui;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--text-2);

.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;

 * To get the radius or the hypoteneuse.
 * If you know the inner angle and the length of the side
 * The end / Math.sin(innerAngle) should provide the radius

section:first-of-type {
  aspect-ratio: 1;
  display: grid;
  place-items: center;

.text-ring {
  --inner-angle: calc((360 / var(--char-count)) * 1deg);
  --character-width: 1;
  font-family: monospace;
  text-transform: uppercase;
  font-size: calc(var(--font-size, 1) * 10vmin);
  position: relative;
  box-shadow: none;

@media (prefers-reduced-motion: no-preference) {
  .text-ring {
    animation: rotation 6s infinite linear;

@keyframes rotation {
  to {
    rotate: -360deg;

.char {
  display: inline-block;
  position: absolute;
  font-weight: bold;
  top: 50%;
  left: 50%;
    translate(-50%, -50%) rotate(calc(var(--inner-angle) * var(--char-index))) translateY(var(--radius));


                const canTrig = CSS.supports('(top: calc(sin(1) * 1px))')
const HEADING = document.querySelector('h1')

const OPTIONS = {
  SIZE: 1,
  TEXT: 'Made by Jhey with CSS Trig functions • ',

const onUpdate = () => {
  // Make the ring text
  const text = OPTIONS.TEXT
  // 1. Take the text and split it into spans...
  const chars = text.split('')
  HEADING.innerHTML = '''--char-count', chars.length)

  for (let c = 0; c < chars.length; c++) {
    HEADING.innerHTML += `<span aria-hidden="true" class="char" style="--char-index: ${c};">${chars[c]}</span>`
  HEADING.innerHTML += `<span class="sr-only">${OPTIONS.TEXT}</span>`
  // Set the styles'--font-size', OPTIONS.SIZE)'--character-width', OPTIONS.SPACING)
      ? 'calc((var(--character-width) / sin(var(--inner-angle))) * -1ch'
      : `calc(
      (${OPTIONS.SPACING} / ${Math.sin(
          360 / HEADING.children.length / (180 / Math.PI)
      * -1ch