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

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.

HTML

              
                <form class="form" action="./" method="POST">
  <div class="form__title">Sign up</div>
  <p class="form__desc">
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos, nostrum? Laudantium molestiae explicabo numquam animi corrupti debitis ratione, accusamus nemo optio eum vero nesciunt facere aperiam! Labore pariatur accusantium exercitationem.
  </p>
  <div class="form__item">
    <label for="givennames" class="form__label">Given Names</label>
    <input type="text" class="form__input" name="givennames" id="givennames" placeholder="Enter your given name(s)">
    <span class="form__error">A sample error message</span>
  </div>
  <div class="form__item">
    <label for="numusers" class="form__label">Number of Users</label>
    <input type="number" class="form__input form__input--small" name="numusers" id="numusers" min="1" max="5" placeholder="How many users? (Max. 5)">
    <span class="form__error">A sample error message</span>
  </div>
  <div class="form__item">
    <label for="expirydate" class="form__label">Expiration Date</label>
    <input type="date" class="form__input form__input--small" name="expirydate" id="expirydate" placeholder="Enter an expiration date">
    <span class="form__error">A sample error message</span>
  </div>
  <div class="form__item">
    <label for="message" class="form__label">Message</label>
    <textarea maxlength="500" class="form__input" name="message" id="message" placeholder="Enter a detailed message about why you wish to signup. (Max. 500 chars)"></textarea>
    <span class="form__error">A sample error message</span>
  </div>
  <div class="form__item">
    <button class="form__btn" type="submit">Sign Up</button>
  </div>
</form>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i&display=swap");

.form {
  font-family: "Source Sans Pro", sans-serif;
  font-size: 16px;
}

.form * {
  box-sizing: border-box;
  line-height: 1.5;
}

.form__title {
  font-size: 2em;
  font-weight: 600;
}

.form__item {
  display: flex;
  flex-direction: column;
}

.form__item > * {
  align-self: flex-start;
}

.form__label {
  font-weight: 600;
  padding: 10px 0;
}

.form__input {
  -webkit-appearance: none;

  width: 100%;
  max-width: 425px;

  /* Fix for Safari/iOS date fields */
  min-height: calc(0.9em + (0.8em * 2) + 0.6em);

  padding: 0.8em;
  font-size: 0.9em;
  font-family: "Source Sans Pro", sans-serif;

  outline: none;
  border: 1px solid #dddddd;
  border-radius: 4px;
  background: #f9f9f9;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.form__input:focus {
  background: #ffffff;
}

.form__input::placeholder {
  color: #bbbbbb;
}

.form__input--error {
  color: #d50000;
  background: #fff8f8;
  border-color: #d50000;
}

.form__input--error::placeholder {
  color: #ffbfbf;
}

.form__error {
  padding-top: 10px;
  color: #d50000;
  font-size: 0.9em;
  visibility: hidden;
}

.form__input--error + .form__error {
  visibility: visible;
}

.form__input--small {
  max-width: 250px;
}

textarea.form__input {
  resize: none;
  min-height: 200px;
}

.form__btn {
  font-family: "Source Sans Pro", sans-serif;
  font-weight: 600;
  font-size: 1.1em;
  padding: 10px 16px;
  margin: 10px 0;

  color: #ffffff;
  background: #14b64a;
  border: 2px solid #0fa942;
  border-radius: 5px;

  cursor: pointer;
  outline: none;
}

.form__btn:active {
  background: #0fa942;
}

              
            
!

JS

              
                document.addEventListener("DOMContentLoaded", function() {
  document.querySelectorAll(".form__input").forEach(function(input) {
    input.addEventListener("input", function() {
      input.className = input.className.replace(/form__input--error ?/, "");
    });
  });
});

              
            
!
999px

Console