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>CSS Color-Contrast() - Target Contrast Demo</h1>

  <p>Using the CSS color-contrast() function, we're able to define our target contrast ratio. This feature is currently (18.3.2022) only available via the <a href="">Safari Technology Preview</a> browser.</p>

  <div class="sample-block">
    <p>Target Ratio: <span>AA (4.5)</span></p>

      Ratio Keywords
      <select id="ratio-keywords">
        <option value="AA (4.5)" selected>AA (4.5)</option>
        <option value="AA-Large (3)">AA-Large (3)</option>
        <option value="AAA (7)">AAA (7)</option>
        <option value="AAA-Large (4.5)">AAA-Large (4.5)</option>

      Custom Ratio
      <input id="custom-ratio" type="range" min=0 max=20 value="4.5" step="0.1" />


  <p>🚀 Use the form controls to adjust the target contrast ratio.</p>

<div class="not-supported">The color-contrast() feature is not supported in your browser.</div>


                body {
  --contrast-target: AA;

.sample-block {
  --color-set: #001219, #005f73, #0a9396, #94d2bd, #e9d8a6, #ee9b00, #ca6702,
    #bb3e03, #ae2012, #9b2226;
  --base: color-contrast(
    var(--body-base) vs var(--color-set) to var(--contrast-target)

  background: var(--base);
  display: grid;
  padding: 0.75em 1em;
  place-items: center;

  p {
    color: color-contrast(var(--base) vs var(--color-set), #fff to AA-Large);

/* GLOBAL */
:root {
  --body-base: #001219;
  --color-primary: #005f73;
  --scrollbar-bg: #222;

body::-webkit-scrollbar {
  width: 10px;
body {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--scrollbar-bg);
body::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
body::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: 6px;
  border: 3px solid var(--scrollbar-bg);

body {
  color: #fff;
  font-family: "Barlow", sans-serif;
  font-size: 100%;
  letter-spacing: 0.25px;
  line-height: 1.75;
  margin: 0;
  padding: 0;

body {
  accent-color: #ee9b00;
  background-image: radial-gradient(
    circle farthest-corner at 100% 0,
    var(--color-primary) 0%,
    var(--color-primary) 15.9%,
    #ee9b00 15.9%,
    #ee9b00 24.4%,
    var(--body-base) 24.5%,
    var(--body-base) 66%
  block-size: 100%;
  display: grid;
  min-block-size: 100vh;
  place-items: center;

a {
  color: #e9d8a6;
  text-decoration: underline 1px dashed;
  text-underline-offset: min(5px, 1em);

  &:hover {
    color: #ffe8d6;

  &:focus {
    outline: 1px solid currentColor;
    outline-offset: 3px;

h2 {
  font-family: "Hubballi", cursive;
  line-height: 1.25;

section {
  inline-size: min(750px, 50vw);

form {
  display: grid;
  grid-gap: 2rem;
  grid-template-columns: 1fr 1fr;
  padding-block-end: 1rem;

label {
  display: grid;
  font-size: 1.2rem;
  font-weight: 600;

input {
  display: block;

.not-supported {
  background: #600;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  position: fixed;
  inset-block-end: 1rem;
  inset-inline-start: 1rem;

  @supports (background: color-contrast(#000 vs #fff, #eee)) {
    display: none;



                document.querySelector("#ratio-keywords").addEventListener("change", (e) => {"--contrast-target",;
  document.querySelector(".sample-block span").innerHTML =;

document.querySelector("#custom-ratio").addEventListener("input", (e) => {"--contrast-target",;
  document.querySelector(".sample-block span").innerHTML =;