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.


                <section class="theme-buttons">
  <button id="default">Default</button>
  <button id="reddish">Red</button>
  <button id="greenish">Green</button>
<h1>CSS Custom Properties</h1>
<p class="alert">Works on Chrome 49+, Firefox 31+, Safari 9.1+ </p>
<p class="notice">Click on any of the buttons above to switch themes.</p>


                :root {
  --theme-font: 'Lato';
  --alert-background: hsl(0, 0%, 80%);
  --button-background: hsl(0, 0%, 70%);
  --heading-background: hsl(0, 0%, 60%);
  --notice-background: hsl(0, 0%, 50%);

* {
  padding: 0;
  margin: 0;
  outline: none;
  box-sizing: border-box;

body {
  font-size: 1.3em;
  font-family: var(--theme-font, 'Arial');
  text-align: center;

h1 {
  clear: both;
  padding: 50px 10px;
  background: var(--heading-background, gray);

.alert {
  padding: 30px 10px;
  background: var(--alert-background, white);

.notice {
  padding: 30px 10px;
  background: var(--notice-background, white);

button {
  padding: 20px 40px;
  margin-bottom: 20px;
  font-size: 1em;
  width: 33.3333%;
  cursor: pointer;
  border: none;
  float: left;
  background: var(--button-background, gray);
  font-family: var(--theme-font, 'Arial');

button:nth-child(2) {
  border-left: 1px solid white;
  border-right: 1px solid white;

button:hover {
  color: white;
  background: black;


                document.getElementById("default").addEventListener("click", defaultTheme);
document.getElementById("reddish").addEventListener("click", redTheme);
document.getElementById("greenish").addEventListener("click", greenTheme);

function defaultTheme() {
  var defaultShades =;
  defaultShades.setProperty('--theme-font', 'Lato');
  defaultShades.setProperty('--alert-background', 'hsl(0, 0%, 80%)');
  defaultShades.setProperty('--button-background', 'hsl(0, 0%, 70%)');
  defaultShades.setProperty('--heading-background', 'hsl(0, 0%, 60%)');
  defaultShades.setProperty('--notice-background', 'hsl(0, 0%, 50%)');

function redTheme() {
  var redShades =;
  redShades.setProperty('--theme-font', 'Pacifico');
  redShades.setProperty('--alert-background', 'hsl(0, 70%, 80%)');
  redShades.setProperty('--button-background', 'hsl(0, 70%, 70%)');
  redShades.setProperty('--heading-background', 'hsl(0, 70%, 60%)');
  redShades.setProperty('--notice-background', 'hsl(0, 70%, 50%)');

function greenTheme() {
  var greenShades =;
  greenShades.setProperty('--theme-font', 'Dosis');
  greenShades.setProperty('--alert-background', 'hsl(90, 70%, 80%)');
  greenShades.setProperty('--button-background', 'hsl(90, 70%, 70%)');
  greenShades.setProperty('--heading-background', 'hsl(90, 70%, 60%)');
  greenShades.setProperty('--notice-background', 'hsl(90, 70%, 50%)');