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

              
                  <header>
    <h3>Example Vanilla Form</h3>
    <p>With just the import from Open Props, no additional classes, have great looking forms.</p>
  </header>
  <form>
    <fieldset id="forms__input">
      <div> 
        <label for="input__name">Text Input</label>
        <input id="input__name" name="name" type="text" placeholder="lorem">
      </div>
      <div> 
        <label for="required__input__name">Required Text Input</label>
        <input id="required__input__name" name="name" type="text" required placeholder="ipsum">
      </div>
      <div>
        <label for="input__password">Password</label>
        <input id="input__password" type="password" autocomplete="new-password" placeholder="················">
      </div>
      <div>
        <label for="input__webaddress">Web Address</label>
        <input id="input__webaddress" type="url" placeholder="https://yoursite.com" autocomplete="url">
      </div>
      <div>
        <label for="input__emailaddress">Email Address</label>
        <input id="input__emailaddress" type="email" placeholder="name@email.com" autocomplete="email">
      </div>
      <div>
        <label for="input__search">Search</label>
        <input id="input__search" type="search" placeholder="Search for flavors" list="searches">
        <datalist id="searches">
          <option value="Chocolate">
          <option value="Vanilla">
          <option value="Strawberry">
        </datalist>
      </div>
      <div>
        <label for="input__phone">Phone Number</label>
        <input id="input__phone" type="tel" inputmode="numeric" placeholder="999-999-9999" minlength="7" maxlength="12" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}">
      </div>
      <div>
        <label for="input__text2">Number Input</label>
        <input id="input__text2" type="number" placeholder="0-100" min="0" max="100">
      </div>
      <div>
        <label for="input__readonly">Read only</label>
        <input readonly id="input__readonly" type="text" value="Nope!">
      </div>
      <div>
        <label for="input__disabled">Disabled</label>
        <input disabled id="input__disabled" type="text" value="Nope!">
      </div>
      <footer>
        <menu>
          <button type="reset">Reset</button>
        </menu>
        <menu>
          <button type="button">Cancel</button>
          <button>Submit</button>
        </menu>
      </footer>
      <legend>Input fields</legend>
    </fieldset>
  </form>
  <form>
    <fieldset id="forms__select">
      <div>
        <label for="select">Pick an option</label>
        <select id="select">
          <optgroup label="Option Group">
            <option>Option One</option>
            <option>Option Two</option>
            <option>Option Three</option>
          </optgroup>
        </select>
      </div>
      <legend>Select menus</legend>
    </fieldset>
  </form>
  <fieldset id="forms__checkbox">
    <legend>Checkboxes</legend>
    <ul class="list list--bare">
      <li><label for="checkbox1"><input id="checkbox1" name="checkbox" type="checkbox" checked="checked"> Choice A</label></li>
      <li><label for="checkbox2"><input id="checkbox2" name="checkbox" type="checkbox"> Choice B, something long enough to become multiline</label></li>
      <li><label for="checkbox3"><input id="checkbox3" name="checkbox" type="checkbox"> Choice C</label></li>
    </ul>
  </fieldset>
  <fieldset id="forms__radio">
    <legend>Radio buttons</legend>
    <ul class="list list--bare">
      <li><label for="radio1"><input id="radio1" name="radio" type="radio" class="radio" checked="checked"> Option 1</label></li>
      <li><label for="radio2"><input id="radio2" name="radio" type="radio" class="radio"> Option 2, something long enough to become multiline</label></li>
      <li><label for="radio3"><input id="radio3" name="radio" type="radio" class="radio"> Option 3</label></li>
    </ul>
  </fieldset>
  <fieldset id="forms__textareas">
    <legend>Textareas</legend>
    <textarea id="textarea" rows="8" cols="48" placeholder="Enter your message here"></textarea>
    <footer>
      <menu>
        <button type="reset">Clear</button>
      </menu>
      <menu>
        <button type="button">Cancel</button>
        <button type="submit">Send</button>
      </menu>
    </footer>
  </fieldset>
  
  <fieldset id="forms__alone-fieldset">
    <legend>Single</legend>
    <label for="list__autocomplete">Text autocomplete</label>
    <input type="text" id="list__autocomplete" list="searches">
  </fieldset>
  
  <form id="login"> 
    <fieldset id="signin__example">
      <legend>Sign In</legend>
      <div> 
        <label for="input__username">Username</label>
        <input id="input__username" name="username" type="text" required autocomplete="username" placeholder="mcgyver" pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$">
      </div>
      <div>
        <label for="input__password2">Password</label>
        <input id="input__password2" type="password" autocomplete="current-password" required placeholder="········" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$" title="Uppercase, lowercase and a number are required">
      </div>
      <footer>
        <menu>
          <button>Login</button>
          <button type="reset">Clear</button>
        </menu>
      </footer>
    </fieldset>
  </form>

  <fieldset>
    <legend>Search</legend>
    <section>
      <search>
        <form>
          <label for="movie">Find a Movie</label>
          <input type="search" id="movie">
          <button type="submit">Search</button>
        </form>
      </search>
    </section>
  </fieldset>

<form action="#" method="post">
  <fieldset>
    <legend>Payment</legend>
    <div>
      <label for="cc-name">Name on card</label>
      <input id="cc-name" name="cc-name" autocomplete="cc-name" maxlength="50" pattern="[\p{L} \-\.]+" placeholder="Full name" required>
      
      <label for="cc-number">Card number</label>
      <input id="cc-number" name="cc-number" autocomplete="cc-number" inputmode="numeric" maxlength="50" pattern="[\d ]{10,30}" placeholder="0000 0000 0000 0000" required>
        
      <label for="cc-exp">Expiry date</label>
      <input id="cc-exp" name="cc-exp" autocomplete="cc-exp" placeholder="MM/YY" maxlength="5" required style="max-inline-size: 9ch">

      <label for="cc-csc">Security code</label>
      <input id="cc-csc" name="cc-csc" inputmode="numeric" maxlength="3" placeholder="xxx" required style="max-inline-size: 6ch">
    </div>
      
    <footer>
      <menu>
        <button type="reset">Reset</button>
      </menu>
      <menu>
        <button type="submit">Pay</button>
      </menu>
    </footer>
  </fieldset>
</form>
  
  <fieldset id="forms__html5">
    <legend>Inputs Extended</legend>
    <div>
      <label for="file-in">File input</label>
      <input type="file" id="file-in" ondragenter="this.classList.add('dropping')" ondragleave="this.classList.remove('dropping')" ondrop="this.classList.remove('dropping')">
    </div>
    <div>
      <label for="ic">Color input</label>
      <input type="color" id="ic" value="#5c7cfa">
    </div>
    <div>
      <label for="ir">Range input</label>
      <input type="range" id="ir" value="10" oninput="rangeToPercent(this)" style="--track-fill: 10%">
    </div>
    <div>
      <label for="ir">Progress element</label>
      <div>
        <progress></progress>
        <progress value=".5">50%</progress>
      </div>
    </div>
    <div>
      <label for="idd">Date input</label>
      <input type="date" id="idd" value="1970-01-01">
    </div>
    <div>
      <label for="idm">Month input</label>
      <input type="month" id="idm" value="1970-01">
    </div>
    <div>
      <label for="idw">Week input</label>
      <input type="week" id="idw" value="1970-W01">
    </div>
    <div>
      <label for="idtl">Datetime-local input</label>
      <input type="datetime-local" id="idtl" value="1970-01-01T00:00">
    </div>
  </fieldset>
</form>
              
            
!

CSS

              
                @use postcss-nested;
@import "https://unpkg.com/open-props";
@import "https://unpkg.com/open-props/normalize.min.css";
@import "https://unpkg.com/open-props/buttons.min.css";

/* 
todo:
  - match button hover effects to checkbox/radio?
  - filter on radios
  - support label wrapped inputs
  - safari file upload button label spacing
  - radio inputs should have round focus ring
  - switch to :user-invalid
  - required red dot change to green when input is fulfilled
  - adaptive icon color
  - less dependencies on <fieldset>
*/

:root {
  /* https://github.com/argyleink/open-props/discussions/65 ?? */
  --icon-error: url(https://api.iconify.design/ic:baseline-error.svg?color=%23ff6b6b);
  --icon-search: url(https://api.iconify.design/ic:search.svg?color=%2300000077);
  --icon-email: url(https://api.iconify.design/ic:email.svg?color=%2300000077);
  --icon-url: url(https://api.iconify.design/ic:link.svg?color=%2300000077);
  --icon-user: url(https://api.iconify.design/ic:person.svg?color=%2300000077);
  --icon-user-editing: url(https://api.iconify.design/ic:person-outline.svg?color=%2300000077);
  --icon-tel: url(https://api.iconify.design/ic:phone.svg?color=%2300000077);
  --icon-tel-editing: url(https://api.iconify.design/ic:phone-in-talk.svg?color=%2300000077);
  --icon-password: url(https://api.iconify.design/ic:baseline-lock.svg?color=%2300000077);
  --icon-password-editing: url(https://api.iconify.design/ic:baseline-lock-open.svg?color=%2300000077);
  --icon-no-edit: url(https://api.iconify.design/ic:baseline-edit-off.svg?color=%2300000077);
  --icon-arrow-down: url(https://api.iconify.design/ic:keyboard-arrow-down.svg?color=%2300000077);
  --icon-arrow-up: url(https://api.iconify.design/ic:keyboard-arrow-up.svg?color=%2300000077);
  
  @media (prefers-color-scheme: dark) {
    --icon-error: url(https://api.iconify.design/ic:baseline-error.svg?color=%23ff6b6b);
    --icon-search: url(https://api.iconify.design/ic:search.svg?color=%23ffffff77);
    --icon-email: url(https://api.iconify.design/ic:email.svg?color=%23ffffff77);
    --icon-url: url(https://api.iconify.design/ic:link.svg?color=%23ffffff77);
    --icon-user: url(https://api.iconify.design/ic:person.svg?color=%23ffffff77);
    --icon-user-editing: url(https://api.iconify.design/ic:person-outline.svg?color=%23ffffff77);
    --icon-tel: url(https://api.iconify.design/ic:phone.svg?color=%23ffffff77);
    --icon-tel-editing: url(https://api.iconify.design/ic:phone-in-talk.svg?color=%23ffffff77);
    --icon-password: url(https://api.iconify.design/ic:baseline-lock.svg?color=%23ffffff77);
    --icon-password-editing: url(https://api.iconify.design/ic:baseline-lock-open.svg?color=%23ffffff77);
    --icon-no-edit: url(https://api.iconify.design/ic:baseline-edit-off.svg?color=%23ffffff77);
    --icon-arrow-down: url(https://api.iconify.design/ic:keyboard-arrow-down.svg?color=%23ffffff77);
    --icon-arrow-up: url(https://api.iconify.design/ic:keyboard-arrow-up.svg?color=%23ffffff77);
  }
}

body::after {
  content: var(--icon-tel-editing) var(--icon-password-editing) var(--icon-user-editing) var(--icon-arrow-up);
  opacity: 0;
  position: absolute;
  z-index: -1;
}

fieldset {
  counter-reset: errors;
  border-color: var(--surface-2);
  box-shadow: var(--shadow-3);
  padding-inline: var(--size-4);
  padding-block: var(--size-2) var(--size-3);
  transition: box-shadow .4s var(--ease-out-4);
  
  &:focus-within {
    box-shadow: var(--shadow-6);
  }
  
  &:focus-within > legend {
    color: var(--link);
  }
  
  & > div:has(:placeholder-shown:required, :not(:placeholder-shown):invalid, :not([placeholder]):required) > label {
    position: relative;
    
    &::after {
      content: "required";
      position: absolute;
      margin-block-start: .5ex;
      margin-inline-start: 1ex;
      text-indent: -200vw;
      inline-size: 6px;
      block-size: 6px;
      border-radius:  var(--radius-round);
      background-color: var(--red-4);
      box-shadow: 0 0 var(--size-2) var(--red-4);
/*       animation: var(--animation-ping); */
    }
  }
   
  &:has(:not(:placeholder-shown):invalid) legend::after {
    text-transform: initial;
		color: var(--red-5);
		content: " (" counter(errors) " errors)";
	}
  
  &:has(:not(:placeholder-shown):invalid) {
		counter-increment: errors;
	}
}

legend {
  display: inline-flex;
  gap: var(--size-2);
  align-items: center;
  min-block-size: 3ch; 
  border: 1px solid var(--surface-2);
  padding-inline: 1.5ch;
  border-radius: var(--radius-round);
  text-transform: uppercase;
  letter-spacing: var(--font-letterspacing-3);
  font-size: var(--font-size-0);
  
  @media (prefers-color-scheme: light) {
    background: white;
  }
}

:where(input:not(
  button,
  [type="button"], 
  [type="file"], 
  [type="number"],
  [type="range"],
  [type="color"],
  [type="checkbox"],
  [type="radio"]
)) {
  /* todo: touch-callout */
  line-height: 2.5;
  padding-block: 0;
  padding-inline: 1.75ch;
  transition: 
    background-color .5s var(--ease-3),
    outline-offset 145ms var(--ease-2);
  
  :placeholder-shown {
    text-overflow: ellipsis;
  }
  
  @media (prefers-reduced-motion: no-preference) {
  &:not(:placeholder-shown):invalid:not(:focus) {
      animation: var(--animation-shake-x);
      animation-duration: .4s;
    }
  }
}

:where(input:not(
  button, 
  input[type="button"], 
  input[type="range"],
  input[type="color"],
  input[type="checkbox"],
  input[type="radio"]
), textarea) {
  box-shadow: var(--shadow-2), 0 0 1px 1px var(--surface-2);
  
  @media (prefers-color-scheme: dark) {
    box-shadow: 
      var(--inner-shadow-2), 
      0 1px 0px 0px var(--dark-surface) inset,
      0 -.5px 0px 0px var(--surface-2) inset;
  }
}

input:is(
/*  [type=text], */
 [type=password],
 [type=url],
 [type=email],
 [type=tel]
) {
  padding-inline-end: 3.5ch;
}

input:is(
 [type=text],
 [type=password],
 [type=url],
 [type=email],
 [type=tel],
 [type=search]
) {
  flex-shrink: 1;
  min-inline-size: 5ch;
  max-inline-size: 100%;
}

input, textarea {
  --dark-surface: var(--gray-11);
}

[readonly]:focus {
  outline: none;
}

input:not(
  button, 
  [disabled], 
  [readonly], 
  [type="file"], 
  [type="button"], 
  [type="submit"], 
  [type="reset"],
  [type="checkbox"],
  [type="radio"]), 
  textarea, 
  select {
  color: var(--text-1);
  
  @media (prefers-color-scheme: light) {
    background-color: white;
  }
  
  &:is(:hover, :focus-within) {
    @media (prefers-color-scheme: dark) {
      background-color: var(--dark-surface);
    }
  }

  &:not(:placeholder-shown, :not([placeholder])):invalid {
    background-image: var(--icon-error);
    background-position: calc(100% - 1.5ch) center;
  }
    
  &:not(:focus-within):not(:placeholder-shown):invalid {
    text-decoration: underline wavy var(--red-6);

    @media (prefers-color-scheme: dark) {
      text-decoration: underline wavy var(--red-4);
    }
  }
}

input[readonly],
input[disabled] {
  cursor: not-allowed;
}

[disabled] {
  opacity: .5;
  box-shadow: none;
  cursor: auto;
}

@keyframes drop-zone {
  from { box-shadow: 0 0 0 0 var(--link) }
  to   { box-shadow: 0 0 0 25px #0000 }
}

input[type="file"] {
  /*  find and remove this from normalize  */
  border: none;
  
  @media (prefers-color-scheme: light) {
    box-shadow: none; 
  }
  
  &.dropping {
    outline: 2px dashed var(--link);
    
    @media (prefers-reduced-motion: no-preference) {
      animation: drop-zone 1.5s var(--ease-out-5) infinite;
    }
  }
}

:where(input[type=file])::-webkit-file-upload-button, :where(input[type=file])::file-selector-button {
  margin: var(--size-3);
}

@media (prefers-color-scheme: dark) {
  :where(input[type=file])::-webkit-file-upload-button,   
  :where(input[type=file])::file-selector-button {
    border-color: transparent;
  }
}

input[type="number"] {
  padding-block: .75ch;
  padding-inline: 1.75ch .75ch;
  min-inline-size: 10ch;
}

input[type="search"] {
  background-image: var(--icon-search);
  background-position: 1.5ch center;
  padding-inline: 4ch 1.25ch;
  border-radius: var(--radius-round);
  
  &::-webkit-search-cancel-button {
    margin-right: -5px;
    padding: .1ch;
  }
  
  &[list]:placeholder-shown {
    background-image: 
      var(--icon-search),
      var(--icon-arrow-down);
    background-position: 1.5ch center, calc(100% - 1.25ch) center;
    background-size: auto, 2.25ch;
    
    &:focus {
      background-image: 
        var(--icon-search),
        var(--icon-arrow-up);
    }
  }
  
  &::-webkit-calendar-picker-indicator {
    color: transparent;
  }
}

input[type="text"][list] {
  background-image: var(--icon-arrow-down);
  background-position: calc(100% - 1.25ch) center;
  background-size: 2.25ch;
  
  &:focus {
    background-image: var(--icon-arrow-up);
  }
  
  &::-webkit-calendar-picker-indicator {
    color: transparent;
  }
}

input[type="password"] {
  background-image: var(--icon-password);
  background-position: calc(100% - 1.5ch) center;
  
  &:focus {
    background-image: var(--icon-password-editing);
  }
}

input[type="email"] {
  background-image: var(--icon-email);
  background-position: calc(100% - 1.5ch) center;
}

input[readonly] {
  background-image: var(--icon-no-edit);
  background-position: calc(100% - 1.5ch) center;
}

input[type="url"] {
  background-image: var(--icon-url);
  background-position: calc(100% - 1.5ch) center;
}

input[type="tel"] {
  background-image: var(--icon-tel);
  background-position: calc(100% - 1.5ch) center;
  
  &:focus {
    background-image: var(--icon-tel-editing);
  }
}

input:where([name*="username"],[id*="username"]) {
  background-image: var(--icon-user);
  background-position: calc(100% - 1.5ch) center;
  background-size: 1.75ch;
  
  &:focus {
    background-image: var(--icon-user-editing);
  }
}

input[type="color"] {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  inline-size: var(--size-8);
  block-size: var(--size-8);
  border-radius: var(--radius-round);
  overflow: hidden;
  box-shadow: var(--shadow-5);
  
  &::-webkit-color-swatch {
    border: none;
  }
  
  &::-webkit-color-swatch-wrapper {
    padding: 0;
  }
}

textarea {
  transition: background-color .5s var(--ease-3);
}

select {
  /*  todo: share more with buttons or use a .btn class  */
  --_bg-light: #fff;
  --_bg-dark: var(--surface-3);
  --_bg: var(--_bg-light);
  background-color: var(--_bg);
  box-shadow: var(--shadow-3), 0 1px var(--surface-3);
  
  appearance: none;
  background-image: var(--icon-arrow-down);
  background-position: calc(100% - 1ch) center;
  background-size: 3ex;
  padding-block: 0.75ch;
  padding-inline: 1.75ch 3ch;
  line-height: 1.5;
  
  &:is(:hover,:focus) {
    /* add button hover */
    background-color: var(--_bg);
  }
  
  &:is(:hover, :focus) {
    background-image: var(--icon-arrow-up);
  }
  
  @media (prefers-color-scheme: dark) {
    --_bg: var(--_bg-dark);
  }
}

/* todo: ship unprefixed as well */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  /* todo: add checkmark icon */
  -webkit-text-fill-color: var(--text-1);
  -webkit-box-shadow: 0 0 0px 1e5px var(--gray-11) inset;
  transition: background-color 5000s ease-in-out 0s;
}

::placeholder {
  color: var(--text-2);
  font-style: italic;
  
  @media (prefers-color-scheme: dark) {
    color: var(--surface-4);
  }
}

::-moz-placeholder {
  opacity: 1;
}

fieldset, form > header {
  display: grid;
  gap: var(--size-2);
}

form {
  display: grid;
  gap: var(--size-8);
}

legend {
  margin-inline-start: -2px;
  color: var(--text-2);
  font-weight: var(--font-weight-6);
}

fieldset {
  gap: var(--size-3);
  max-inline-size: max-content;
  
  @media (width > 720px) {
    gap: var(--size-2);
  }
  
  & > div {
    display: grid;
    grid-auto-columns: 1fr;
    gap: var(--size-2) var(--size-3);
    align-items: center;
    
    @media (width > 720px) {
      grid-template-columns: var(--size-content-1) auto;
    }
    
    & > label {
      justify-self: start;
    }
  }
  
  & > footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--size-3);
    margin-block-start: var(--size-6);
    
    & > menu:only-child {
      margin-inline-start: auto;
    }
  }
  
  & > ul {
    padding: 0;
    margin: 0;
    list-style-type: none;
    display: grid;
    gap: var(--size-2);
    
    & > li {
      padding: 0;
      
      & > label {
        display: inline-flex;
        align-items: baseline;
        gap: var(--size-4);
        max-inline-size: var(--size-content-1);
        
        & > input {
          margin-inline-start: 0;
          flex-shrink: 0;
        }
      }
    }
  }
}

search {
  & > form {
    gap: var(--size-3);
    grid-template-columns: minmax(20ch, 1fr) auto;
    
    & > label {
      grid-column: span 2;
    }
  }
}

:where(
  input[type="checkbox"],
  input[type="radio"]
) {
  aspect-ratio: 1;
  box-shadow: var(--shadow-6);
  transform-style: preserve-3d;
  cursor: pointer;
  
  --isLTR: 1;
  --isRTL: -1;
  
  &:dir(rtl) {
    --isLTR: -1;
    --isRTL: 1;
  }

  &:hover::before {
    --thumb-scale: 1;
  }

  @media (hover: none) {
    inline-size: 1.5rem;
    block-size: 1.5rem;
  }

  &::before {
    --thumb-scale: .01;
    --thumb-highlight-size: 225%;

    content: "";
    inline-size: var(--thumb-highlight-size);
    block-size: var(--thumb-highlight-size);
    clip-path: circle(50%);
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    background: hsl(0 0% 50% / 20%);
    transform-origin: center center;
    transform: 
      translateX(calc(var(--isRTL) * 50%)) 
      translateY(-50%) 
      translateZ(-1px) 
      scale(var(--thumb-scale))
    ;
    will-change: transform;

    @media (prefers-reduced-motion: no-preference) {
      transition: transform .2s ease;
    }
  }
}

input[type="range"] {
  --track-height: .5ex;
  --track-fill: 0%;
/*   --_track-fill: calc(100% * attr(value number, 0) / attr(max number, 100)); */
  --track-color: var(--dark-surface);
  --thumb-size: 3ex;
  --thumb-offset: -1.25ex;
  --thumb-highlight-color: lch(100 0 0 / 20%);
  --thumb-highlight-size: 0px;
  
  @media (prefers-color-scheme: light) {
    --thumb-highlight-color: lch(0 0 0 / 20%);
    --track-color: var(--surface-2);
  }

  display: block;
  inline-size: 100%;
  margin: 1ex 0;
  appearance: none;
  background: transparent;
  outline-offset: 5px;

  @media (hover: none) {
    & {
      --thumb-size: 30px;
      --thumb-offset: -14px;
    }
  }

  &::-webkit-slider-runnable-track {
    appearance: none;
    block-size: var(--track-height);
    border-radius: 5ex;
    box-shadow: var(--inner-shadow-2);
    background: 
      linear-gradient(
        to right, 
        transparent var(--track-fill), 
        var(--track-color) 0%
      ),
      var(--link);
  }

  &::-moz-range-track {
    appearance: none;
    block-size: var(--track-height);
    border-radius: 5ex;
    box-shadow: var(--inner-shadow-2);
    background: 
      linear-gradient(
        to right, 
        transparent var(--track-fill), 
        var(--track-color) 0%
      ),
      var(--link);
  }

  &::-webkit-slider-thumb {
    appearance: none;
    cursor: ew-resize;
    border: 3px solid var(--surface-1);
    block-size: var(--thumb-size);
    inline-size: var(--thumb-size);
    margin-block-start: var(--thumb-offset);
    border-radius: 50%;
    background: var(--link);
    box-shadow: 0 0 0 var(--thumb-highlight-size) var(--thumb-highlight-color);
    
    @media (prefers-reduced-motion: no-preference) {
      & {
        transition: box-shadow .1s ease;
      }
    }

    @nest .fieldset-item:focus-within & {
      border-color: var(--surface-2);
    }
  }

  &::-moz-range-thumb {
    appearance: none;
    cursor: ew-resize;
    border: 3px solid var(--surface-1);
    block-size: var(--thumb-size);
    inline-size: var(--thumb-size);
    margin-block-start: var(--thumb-offset);
    border-radius: 50%;
    background: var(--link);
    box-shadow: 0 0 0 var(--thumb-highlight-size) var(--thumb-highlight-color);

    @media (prefers-reduced-motion: no-preference) {
      & {
        transition: box-shadow .1s ease;
      }
    }

    @nest .fieldset-item:focus-within & {
      border-color: var(--surface-2);
    }
  }

  &:is(:hover,:active) {
    --thumb-highlight-size: 10px;
  }
}

@media (pointer: coarse) {
  input[type="checkbox"],
  input[type="radio"]{
    inline-size: var(--size-4);
    block-size: var(--size-4);
  }
}








body {
  display: grid;
  place-content: center;
  padding: var(--size-5);
  gap: var(--size-7);
}

.buttons-list {
  display: flex;
  gap: var(--size-3);
}
 
#signin__example {
  gap: var(--size-4);
  
  & > div {
    grid-template-columns: 1fr;
    gap: var(--size-2);
  }
  
  & > footer {
    margin-block-start: var(--size-2);
    
    & > menu {
      flex-direction: row-reverse;
    }
  }
}
              
            
!

JS

              
                const rangeToPercent = range => {
  const max = range.getAttribute('max') || 100
  const percent = range.value / max * 100

  range.style.setProperty('--track-fill', `${parseInt(percent)}%`)
}
              
            
!
999px

Console