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 registerform" autocomplete="off" novalidate="">
  <legend>Simple CSS Form Validation</legend>
	  <div class="FormItem NameItem">
      <input type="text" id="name" name="name" placeholder="Name" maxlength=”20” class="formInput" required />
      <span class="validation"> OK </span>
  </div>
  <div class="FormItem PassItem">
      <input type="password" id="password" name="password" placeholder="Password" class="formInput" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}" />
      <span class="validation"> OK </span>
  </div>
  <div class="FormItem EmailItem">
  <input type="email" placeholder="Enter your email address" tabindex="1" class="formInput newsletter-email" required>
    <span class="validation"> OK </span>
	  <!--<input type="submit" value="OK" tabindex="2" class="validation newsletter-submit"> -->
  </div>
</form>
<p class="Explanations">
  JS optional to check the validation on focusout. <br /> Can be uncommented.
  </p>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  outline: none;
}
input:focus, textarea:focus, select:focus { background-color: #ddd; box-shadow: 0 0 0.75em #FF0404; border: 0 none; color: #080808; }
input:focus:valid { box-shadow: 0 0 0.75em green;}
::-webkit-input-placeholder  { color:#676767; transition:all 0.333s ease-in-out; }
::-moz-placeholder {color: #676767;opacity: 1; transition:all 0.333s ease-in-out; }
:-moz-placeholder { color:#676767; opacity: 1; transition:all 0.333s ease-in-out; }
:-ms-input-placeholder {color: #676767; -ms-transition: all 0.2s ease;}
[placeholder]:focus::-webkit-input-placeholder { transition: text-indent 0.15s 0.15s ease; text-indent: -200%; opacity: 1; }

body {
  background:rgb(75, 121, 207);
  color: #252525;
  font-family: "Roboto", Helvetica, Arial, "Lucida Grande", sans-serif;
  font-size:16px;
  padding:0.5rem;
  transition:none;
  background:linear-gradient(270deg, rgb(71, 74, 51), rgb(100, 105, 47), rgb(143, 129, 63));
  background-size: 300% 400%;
}  


.form {
  display: block;
  position: relative;
  max-width: 400px;
  margin: 2rem auto;
  font-size:1.5rem;
}

input {
  font: 1em "Roboto", Helvetica, Arial, "Lucida Grande", sans-serif;
  font-weight: 300;
  padding: 1rem;
}

.FormItem {
  display:inline-block; width:100%; margin: 0.5em auto 0.5em; position:relative; font-size:1em;
}

.formInput {
  display: block;
  width: 100%;
  padding-right: 3rem;
  box-sizing:border-box;
}
.validation { width:2.75em; height:4rem; background:#CCC; padding:0; margin:0; line-height:4rem; text-align:center; font-weight:normal;
  font-family: "Roboto", Helvetica, Arial, "Lucida Grande", sans-serif;
  position: absolute;
  top: 0;
  right: 0;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease 0.125s;
  cursor:not-allowed;
  width:2.75em;
  color:transparent;
  
}
.newsletter-submit{}
.formInput.empty + .validation,
.formInput:focus:invalid + .validation,
.formInput:active:invalid + .validation {
  opacity: 1;
  background-color: red;
  color:transparent;
  transition: none;
}
.formInput.empty + .validation:after,
.formInput:focus:invalid + .validation:after,
.formInput:invalid + .validation:after {
  display:block;
  content: "!";
  color:yellow;
  position:absolute;
  right:0;
  top:0;
  width:100%;
  height:auto;
  font-weight:bold;
  text-shadow:2px 2px 3px #333, 3px 3px 3px #111;
  font-size:2em;
  line-height:1.286em;
  z-index:999;
}
.formInput:valid + .validation {
  opacity: 1;
  color: #fff;
  background-color: #4CD964;
  pointer-events: auto;
  cursor:default;
}

.Explanations { color:#FFF; font-size:1.333rem; text-align:center; display:block; margin:1em auto;}






              
            
!

JS

              
                // with JS --> Osvaldas Valutis, http://osvaldas.info/minimalist-newsletter-subscription-form

// NO JS --> https://www.designernews.co/users/8690/dan-klammer
// https://output.jsbin.com/teney

/*
$('input').keyup(function() {
    if( $(this).val() == ""){
        $(this).addClass("empty");
    }else{
        $(this).removeClass("empty");
    }
}).focusout(function() {
    if( $(this).val() == "" || $(this).isValid() ){
        $(this).addClass("empty");
    }else{
        $(this).removeClass("empty");
    }
}); 
*/
              
            
!
999px

Console