cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <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 is needed to check the validation on focusout. <br /> Can be uncommented.
  </p>
            
          
!
            
              * {
  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;}






            
          
!
            
              // 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
Loading ..................

Console