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

Save Automatically?

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

              
                <pre>
      <code>:root { accent-color: <span id=accent>red</span>; }</code>
    </pre>
    <dl>
      <dt>
        <label for="check">Checkbox</label>
      </dt>
      <dd>
        <input type=checkbox id=check checked>
      </dd>
      <dt>
        <label for=radio-one>Radio Buttons</label> 
      </dt>
      <dd>
        <input type=radio name=radio id=radio-one checked>
        <input type=radio name=radio id=radio-two>
        <input type=radio name=radio id=radio-three>
      </dd>
      <dt>
        <label for="progress">Progress Element</label>
      </dt>
      <dd>
        <progress id="progress" max=100 value=35></progress>
      </dd>
      <dt>
        <label for="range">Range Input</label>
      </dt>
      <dd>
        <input type="range" id="range" value="40" min="0" max="100" step="1">
      </dd>
    </dl>
    <fieldset>
      <legend>Change accent-color</legend>
      <label for=hue>Hue</label>
      <input id=hue type=range min=0 max=360 step=1 value=5>
      <label for=saturation>Saturation</label>
      <input id=saturation type=range min=0 max=100 step=1 value=69>
      <label for=lightness>Lightness</label>
      <input id=lightness type=range min=0 max=100 step=1 value=54>
    </fieldset>
              
            
!

CSS

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

*,
*:after,
*:before {
	box-sizing: border-box;
}

:root {
	accent-color: var(--accent-color, hsl(280 80% 10%));
}

body {
	display: grid;
	place-items: center;
	align-content: center;
	min-height: 100vh;
	gap: 3rem;
	font-family:  'Google Sans', sans-serif, system-ui;
}

#accent {
	color: var(--accent-color);
}

dl {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	justify-items: left;
	align-content: center;
	gap: 2rem 2rem;
}

dt {
	margin: 0;
}

dd {
	justify-self: center;
}

:where(progress, [type=range]) {
	width: 140px;
}

pre {
	font-weight: var(--font-weight-9);
	background: var(--surface-2);
	color: var(--text-1);
	padding: 2rem;
	border-radius: var(--radius-3);
	display: grid;
}

fieldset {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 1rem 2rem;
}
              
            
!

JS

              
                const ACCENT = document.querySelector('#accent')

const HUE_RANGE = document.querySelector('#hue')
const SATURATION_RANGE = document.querySelector('#saturation')
const LIGHTNESS_RANGE = document.querySelector('#lightness')

const UPDATE = () => {
  const ACCENT_COLOR = `hsl(${HUE_RANGE.value} ${SATURATION_RANGE.value}% ${LIGHTNESS_RANGE.value}%)`
  ACCENT.innerText = ACCENT_COLOR
  document.documentElement.style.setProperty('--accent-color', ACCENT_COLOR)
}

UPDATE()

HUE_RANGE.addEventListener('input', UPDATE)
SATURATION_RANGE.addEventListener('input', UPDATE)
LIGHTNESS_RANGE.addEventListener('input', UPDATE)
              
            
!
999px

Console