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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

  Some stuff here with <a href="">a link even</a> woopty doo 🎉

  <h1>Here's some block</h1>
  <p>It has buttons with a background and a border and text. Click a button below to change the theme.</p>
  <button onclick="themeReset()">Default Theme</button>
  <button onclick="themeDark()">Dark Theme</button>
  <button onclick="themeOtherMix()">Other Theme (Dark + Other Mix)</button>
  <button onclick="themeOther()">Other Theme (Default + Other)</button>

<p>So now you get the idea? Define every color ever used in an app as a variable, then make a theme by changing those variables. The only CSS you'll be writing is changing variables.

You could split them up into individual theme files and import when needed.</p>
              // Here's your main theme
:root {
  --body-bg: #fff;
  --nav-bg: #ccc;
  --nav-text: #000;
  --link-color: hsla(287, 56%, 34%, 1);
  --h1-color: #444;
  --text-color: #666;
  --button-border-color: #6A48EA;
  --button-text-color: #000;
  --button-bg-color: hsla(253, 100%, 90%, .5);

// Here's your dark theme
body.dark {
  --body-bg: #111;
  --nav-bg: #222;
  --nav-text: #ccc;
  --link-color: #2CC6F8;
  --h1-color: #999;
  --text-color: #dadada;
  --button-border-color: #222;
  --button-text-color: var(--link-color); // how fucking cool is that
  --button-bg-color: #222;

// And here I'll just selectively change some colors
// Others will stay as default defined in :root
// BUT if you mix classes, this one will be applied too
// since it's after .dark
body.other {
  --nav-bg: #6A48EA;
  --nav-text: #fff;
  --link-color: #2CC6F8;
  --h1-color: var(--nav-bg);

body {
  background-color: var(--body-bg);
  font-size: 16px;
  padding: 3rem 1rem;

nav {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background-color: var(--nav-bg);
  color: var(--nav-text);

a {
  color: var(--link-color);

h1 {
  color: var(--h1-color);

p {
  color: var(--text-color);

button {
  border: 2px solid var(--button-border-color);
  background-color: var(--button-bg-color);
  color: var(--button-text-color);
  padding: .5rem 1rem;
  font-size: 1rem;
  border-radius: .35em;
              function themeReset() {
  document.body.classList.remove('dark', 'other')

function themeDark() {

function themeOtherMix() {
  document.body.classList.add('other', 'dark')

function themeOther() {
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.