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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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>Message form</h1>
  <form id="form">
    <div class="input_container">
      <label for="input_firstname">First name</label>
      <input id="input_firstname" name="firstname" type="text"></input>
    <div class="input_container">
      <label for="input_lastname">Last name</label>
      <input id="input_lastname" name="lastname" type="text"></input>
    <div class="input_container">
      <label for="input_email">Email</label>
      <input id="input_email" name="email" type="text"></input>
    <div class="input_container">
      <label for="input_messagesubject">Message subject</label>
      <input id="input_messagesubject" name="messagesubject" type="text"></input>
    <div class="input_container">
      <label for="input_messagebody">Message content</label>
      <textarea rows=3 id="input_messagebody" name="messagebody" type="text"></textarea>
    <button type="submit">Submit</button>

<!-- Follow me -->
  Made with
  <i>♥</i> by
  <a target="_blank" href="">Matthew Burfield</a>


                body {
  font-family: "Montserrat", sans-serif;
  background: rgb(2, 0, 36);
  background: linear-gradient(
    rgba(2, 0, 36, 1) 0%,
    rgba(9, 9, 121, 1) 32%,
    rgba(0, 212, 255, 1) 100%
  width: 100vw;
  height: 100vh;

section {
  box-shadow: 0 10px 15px 0 rgba(31, 45, 65, 0.4);
  background-color: #fbfbfb;
  border: rgba(0, 0, 0, 0);
  border-radius: 5px;
  overflow: hidden;
  margin: 50px auto 0;
  width: 400px;

section h1 {
  color: #00b494;
  font-weight: 500;
  line-height: 3.5;
  font-size: 1rem;
  background-color: #f2f2f2;
  border-bottom: 1px solid #e4e3e2;
  padding: 0 20px;
  margin: 0;

form {
  padding: 20px;

.input_container {
  border: 1px solid #8a8a8a;
  position: relative;
  display: flex;
  flex-direction: column; /* This makes the input fill the width */
  border-radius: 2px;
  margin-bottom: 10px;

.input_container label {
  position: absolute;
  left: 15px;
  top: 22px;
  display: block;
  background-color: #fff;
  padding: 0 5px;
  margin: 0;
  font-weight: 300;
  color: #8a8a8a;
  font-size: 1.125rem;
  line-height: 10px;
  cursor: text;
  z-index: 1;
  will-change: transform;
  transition: transform 0.2s ease-in-out;
  transform-origin: left; /* Keeps the label left aligned after it gets scaled */

.input_container input,
.input_container textarea {
  background-color: rgba(255, 255, 255, 0.8);
  padding: 0 15px;
  border: none;
  height: auto;
  position: relative;
  font-size: 1.125rem;
  color: #2e2e2e;

.input_container input {
  line-height: 3;

.input_container textarea {
  line-height: 1.2;
  padding-top: 20px;
  padding-bottom: 20px;

.input_container.focused label {
  color: #0080cb;

.input_container.focused label,
.input_container.hasValue label {
  transform: translateY(-27px) scale(0.7);

button[type="submit"] {
  color: white;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  font-weight: 700;
  display: inline-block;
  border-radius: 5px;
  background-color: #00b494;
  margin: 10px 0 0;
  padding: 12px 16px;
  border: none;
  cursor: pointer;
  width: 100%;
  font-size: 1.2rem;

footer {
  color: #fff;
  padding-top: 50px;
  text-align: center;

footer a {
  color: #fff;

footer i {
  color: #eb2f2f;
  font-size: 1.5rem;



                const inputElementList = document.querySelectorAll(
  "div.input_container input, div.input_container textarea"
// The "focused" class triggers the css transition on the placeholder text
inputElementList.forEach((inputEl) => {
  inputEl.addEventListener("focus", (el) => {"focused");"hasValue");
inputElementList.forEach((inputEl) => {
  inputEl.addEventListener("blur", (el) => {
    // We only want to transition the placeholder text back to normal
    // if the input element doesn't have a value
    if ( === "") {"hasValue");

// Stop the form from actually submitting
document.getElementById("form").addEventListener("submit", (e) => {