Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="container">
  <form action="/" method="post" enctype="application/x-www-form-urlencoded">
    <fieldset>
      <ul>
        <li>
          <label for="fname"><b>✱</b> Name</label>
          <input type="name" name="fname" id="fname" required="">
        </li>
        <li>
          <label for="pass"><b>✱</b> Password</label>
          <input type="password" name="pass" id="pass" required="">
        </li>
        <li>
          <label for="em"><b>✱</b> Email</label>
          <input type="email" name="em" id="em" pattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?" required="" />
        </li>
        <li>
          <label for="ic">Favorite Ice Cream</label>
          <input type="text" name="ic" id="ic" />
        </li>
      </ul>
    </fieldset>

    <input type="submit" name="submit-btn" class="btn" value="submit">
 </form>
</div>
              
            
!

CSS

              
                @import "compass/css3";

/* ==================================================================================
 * AUTHOR STYLES
 * ==================================================================================
 */


/*
 * =========================================
 * globals
 * =========================================
 */

* {
  box-sizing: border-box; // box sizing FTW!
}

html {
  background: url(https://cdn.css-tricks.com/wp-content/themes/CSS-Tricks-10/images/bg.png) top left repeat;
}


/*
 * =========================================
 * container
 * =========================================
 */

.container {
  max-width: 494px;
  margin: 5em auto;
  font-family: 'Istok Web', sans-serif;
}

/*
 * =========================================
 * form
 * =========================================
 */

form {
  box-shadow: 0 0 0 14px rgba(255,255,255,0.10);
  overflow: auto;
  background: #d6d5d5 url(https://cdn.css-tricks.com/wp-content/themes/CSS-Tricks-10/images/module-lodge-bg.jpg) top left no-repeat;
}

fieldset {
  border: none;
}

form ul {
  list-style-type: none;
  margin: 5em auto 0;
  padding: 0; /* normalize override */
}

form ul li {
  display: inline-block;
  margin: .4125em auto;
  width: 100%;
}

/*
 * =========================================
 * form fields/labels
 * =========================================
 */

label,
input {
  float: left;
}

label {
  margin-right: 3%;
  padding: .375em;
  width: 37%;
  line-height: 1.375;
  background: rgba(255,255,255,0.9);
  color: #514a3e;
}

label b {
  color: red;
}

input {
  padding: .4125em;
  width: 60%;
}


/*
 * =========================================
 * submit btn
 * =========================================
 */

.btn {
  border: none;
  box-shadow: 1px 0px 1px #203891,0px 1px 1px #3852b1,2px 1px 1px #203891,1px 2px 1px #3852b1,3px 2px 1px #203891,2px 3px 1px #3852b1,4px 3px 1px #203891,3px 4px 1px #3852b1,5px 4px 1px #203891,4px 5px 1px #3852b1,6px 5px 1px #203891;
  margin: .025em .5em 1.625em; // normalize override
  padding: .825em;
  position: relative;
  top: -5px;
  left: 0;
  width: 95%;
  font-family: 'Istok Web', sans-serif;
  font-weight: 900;
  background: #3d57b4;
  color: #FFF;
}

.btn:active {
  box-shadow: 1px 0px 1px #203891,0px 1px 1px #3852b1,2px 1px 1px #203891,1px 2px 1px #3852b1,3px 2px 1px #203891;
  top: -2px;
  left: 3px;
}



/* ==================================================================================
 * DEMO STLYES
 * ==================================================================================
 */

/*
 * =========================================
 * :required pseudo class styling
 * =========================================
 */

input:required {
  border: 1px solid red;
  background: rgba(250,0,0,0.85);
  
}

input:required:focus {
  outline: none; /* normalize override */
  border: 1px solid red;
  background: rgba(250,0,0,1);
}

input:required:hover {
  background: rgba(250,0,0,1);
}

/*
 * =========================================
 * :optional pseudo class styling
 * =========================================
 */
input[type="text"]:optional {
  background: rgba(255,255,255,0.85);
}

input[type="text"]:optional:focus {
  background: rgba(255,255,255,1);
}

input[type="text"]:optional:hover {
  background: rgba(255,255,255,1);
}

/*
 * =========================================
 * validation state styling
 * =========================================
 */

input[type="name"]:valid,
input[type="password"]:valid,
input[type="email"]:valid {
  border: none;
  background: rgba(60, 92, 180, .85);
  color: #FFF;
}

input:invalid {
  border: 2px solid maroon;
}

input:invalid:focus {
  border: 2px solid red;
}

/*
 * =========================================
 * bubble message styling
 * =========================================
 */

::-webkit-validation-bubble-message {
  padding: 1em;
  font-family: 'Istok Web', sans-serif;
  color: white;
}

::-webkit-validation-bubble-message,
::-webkit-validation-bubble-arrow {
  background: maroon;
}

              
            
!

JS

              
                // References 
// http://marakana.com/s/post/1336/styling_html5_form_validation_messages_with_css3
// https://www.html5rocks.com/en/tutorials/forms/constraintvalidation
// http://html5doctor.com/css3-pseudo-classes-and-html5-forms

//Pseudo Element Bubble Message Selectors
//::-webkit-validation-bubble {}
//::-webkit-validation-bubble-message {}
//::-webkit-validation-bubble-arrow {}
//::-webkit-validation-bubble-arrow-clipper {}
              
            
!
999px

Console