Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

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


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.


                <h1>Open the developer console</h1>

  /* This approach works for internal style blocks too */
  body {
    --color-internal: #b42634;


                /*You might need to refresh when you add a new custom property due to the codepen iframe*/
html {
  --color-accent: #00eb9b;
  --color-accent-secondary: #9db4ff;
  --color-accent-tertiary: #f2c0ea;
  --color-text: #292929;
  --color-divider: #d7d7d7;

.special {
  --color-special: #9a1f74;

  Demo styles:
  These are only to display our color palette, they don't impact the process of reading custom properties.

html {
  color: var(--color-text);
  font-family: sans-serif;

.colors {
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;

.color {
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  padding: 0.5rem;
  transition: box-shadow 0.15s;

.color:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);

.color__swatch {
  background-color: var(--color);
  border-radius: 2px 2px 0 0;
  display: block;
  height: 11rem;

.color__details {
  font-size: 1.375rem;
  padding: 0.5rem;
  text-align: right;

.color input {
  border: 0;
  display: block;
  font-family: monospace;
  font-size: inherit;
  margin: 0;
  padding: 0.2rem;
  text-align: right;
  width: 100%;



                const isSameDomain = (styleSheet) => {
  if (!styleSheet.href) {
    return true;

  return styleSheet.href.indexOf(window.location.origin) === 0;

const isStyleRule = (rule) => rule.type === 1;

const getCSSCustomPropIndex = () =>
    (finalArr, sheet) =>
        [...sheet.cssRules].filter(isStyleRule).reduce((propValArr, rule) => {
          const props = [].map((propName) => [

          return [...propValArr, ...props];
        }, [])