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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 or require. We'll also process your JavaScript with Babel.

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


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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

              <div class="wrapper">
  <h1>The importance of the type attribute for buttons</h1>

<div class="wrapper">
  <form action="" id="my-form">
      <legend>The Form</legend>
      <p>These buttons are within the <code>form</code> tag.</p>
      <p>When the form is submitted, the background colour changes.</p>
      <button type="submit">"Submit" type</button>
      <button type="button">"Button" type</button>
      <button type="reset">"Reset" type</button>
      <button>No type</button>

<div class="wrapper">
  <p>For comparison, these buttons are outside the form. They don't trigger the <code>submit</code> event, and therefore do nothing.</p>
    <button type="submit">"Submit" type</button>
    <button type="button">"Button" type</button>
    <button type="reset">"Reset" type</button>
    <button>No type</button>

<div class="wrapper">
  <p>The form above executes a JavaScript function on the <code>submit</code> event. The function changes the background colour of this page. The form contains four buttons, each with a different <code>type</code> attribute value: <code>type="submit"</code>, <code>type="button"</code>, <code>type="reset"</code> and no <code>type</code> attribute. Click each button and notice which ones trigger the <code>onsubmit</code> event. You may be surprised! Or not.</p>

              $color-button: #d32f2f;
$color-button: #d32f2f;
$color-button-background: #fdfdfd;
$color-shadow: #222;
$color-wrapper-background: #f3f3f3;
$color-submit-button: #388e3c;
$color-button-button: #1565c0;
$color-reset-button: #f57c00;

button {
  height: 36px;
  border: 3px solid $color-button;
  font-size: 16px;
  background-color: $color-button-background;
  cursor: pointer;
  color: $color-button;
  box-shadow: 3px 3px $color-shadow;
  margin-right: 10px;
  margin-top: 10px;
  padding: 0 20px;

  &:hover {
    opacity: 0.7;

  &:active {
    background-color: #eee;
    opacity: 1;

button[type="submit"] {
  border: 3px solid $color-submit-button;
  color: $color-submit-button;

button[type="button"] {
  border: 3px solid $color-button-button;
  color: $color-button-button;

button[type="reset"] {
  border: 3px solid $color-reset-button;
  color: $color-reset-button;

.wrapper {
  background-color: $color-wrapper-background;
  border-radius: 3px;
  padding: 5px;
  margin-bottom: 15px;
  box-shadow: 5px 5px $color-shadow;
  border: 1px solid $color-shadow;
  margin-bottom: 25px;

body {
  font-family: Raleway, sans-serif;
  padding: 0 5%;

h1 {
  margin: 0;

fieldset {
  border: 3px dashed $color-shadow;

              let changeBackground = function(e) {
  // Thnx
  let newRandomHex = "#" + Math.floor(Math.random() * 16777215).toString(16);
  console.log(newRandomHex); = newRandomHex;

let form = document.querySelector("#my-form");

  function(e) {