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. 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <form>
   <h3>CONTACTEZ NOUS !</h3>
   <div>
      <input type="text" id="nom" placeholder="Qui êtes-vous ?"/>
   		<label for="nom">Nom</label>
   </div>
   <div>
      <input type="text" id="prenom" placeholder="Qui êtes-vous ?"/>
   		<label for="prenom">Prénom</label>
   </div>
   <div>
      <input type="text" id="mail" placeholder="Quelle est votre adresse Mail ?"/>
   		<label for="mail">Mail</label>
   </div>
   <div>
      <textarea id="msg"  placeholder="Tapez ici votre message"/></textarea>
      <label for="msg">Message</label>
   </div>
   <input class="button" type="submit" value="Envoyer" />
</form>
  
  
            
          
!
            
              /* Ressources */
html{  background:url('//vincentrocher.fr/codepen/images/backgrounds/background-desktop.jpg') center;
  background-size:cover;
  min-height:100%;
  font-family:"Quicksand","Open Sans",sans-serif;
  padding-top:50px;
}
form{
  max-width:850px;
  margin:0 auto;
  border-top:15px solid #313A3D;
  background:#FFF;
  padding:0 20px 60px;
  text-align:center;
  font-family:Raleway;
  text-align:center;
  color:#B6B6B6;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  opacity:0.95;
  box-shadow:0 0 15px -1px #141414;
}
h3{
  text-transform:uppercase;
  font-size:20px;
  line-height:60px
}
div *{box-sizing:border-box;}
div{
  width:70%;
  margin:10px auto;
  height:50px;
}
div input, textarea{
  width:100%;
  height:100%;
  opacity:0.9;
  padding-left:22%;
  background-color:#E8E9EA;
  border:0;
  outline:none;
  margin:0;
}
label{
  display:block;
  position:relative;
  top:-50px;
  width:100%;
  height:100%;
  background-color:#313A3D;
  position:relative;
  line-height:50px;
  font-size:18px;
  transition: all 0.3s ease-in-out,width 0.7s ease-in-out;
  text-transform:uppercase;
}
.ouvert label{ width:20%; }
#formContact .contactChamp:nth-child(3) label{
  transition: all 0.3s ease-in-out, width 0.7s ease-in-out; }
#formContact .contactChamp:nth-child(4) label{
  transition: all 0.3s ease-in-out, width 0.9s ease-in-out; }
#formContact .contactChamp:nth-child(5) label{
  transition: all 0.3s ease-in-out, width 1.1s ease-in-out; }
#formContact .contactChamp:nth-child(6) label{
  transition: all 0.3s ease-in-out, width 1.3s ease-in-out; }


div:hover label, div input:focus + label,div textarea:focus + label, .labelOuvert{
  width:20%;
}
div input:focus + label,div textarea:focus + label{
  background-color:rgb(116, 181, 89);
  color:#313A3D;
}
input[type=submit]{
  background-color:#313A3D;
  border:0;
  height:50px;
  padding:0 20px;
  text-transform:uppercase;
  color:rgb(116, 181, 89);
  font-size:15px;
  margin-top:35px;
}
textarea{
  resize: none;
  padding-top:18px;
  transition:all 0.3s ease-in-out;
}
textarea + label{
  top:-54px;
}
textarea:focus, .messOuvert textarea{
  height:150px;
}
textarea:focus + label,.messOuvert label{
  top:-154px;
  height:150px;
  line-height:150px;
}
.messOuvert{
  margin-bottom:100px
}



@media screen and (max-width: 1070px) {
  form{
    width:100%;
  }
  form div{
    width:90%;
  }
}
            
          
!
            
              $('form').delay(1000).addClass('ouvert');


// En sortant d'un champ du Form (désélection)
$('input,textarea').blur(function () {
  if($(this).siblings('label').attr('for')=='msg'){ // Si c'est le textarea Message
    $(this).parent().css('margin-bottom','0'); // On retire la marge (qui baisse le bouton submit)
  }
  if ( $(this).val() != '' ) { // Si le champs est rempli
    $(this).siblings('label').addClass('labelOuvert'); // On laisse le label en petit
    if($(this).siblings('label').attr('for')=='msg'){ // Si c'est le champ message
      $(this).parent().addClass('messOuvert'); // Ajout de la classe pour agrandir le champ
      $(this).parent().css('margin-bottom','100px'); // On baisse le bouton
    }
  }
  else {
    $(this).siblings('label').removeClass('labelOuvert');
    if($(this).siblings('label').attr('for')=='msg'){ // Si c'est le textarea Message
      $(this).parent().removeClass('messOuvert'); // Retrait de la classe pour reduire le champ
    }
  }
});

$('textarea').focus(function () { // Au clic sur le textarea Message
  if($(this).val() == ''){ // Si le champ est vide
    $(this).parent().css('margin-bottom','100px'); // Rajout de la marge pour baisser le bouton submit
  }
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console