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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 id='container'>
  <div class='about'>
    <p class="slogan">Just check it !</p>
    <h1>Login Form with Sign In button validation</h1>
    <p class="description">It validates <u>empty fields</u>, <u>logins & passwords shorter than 3 signs</u> and also <u>"Lost Your Password"</u> link.</p>
    <h3 class='owner'>Made by <a href='https://codepen.io/kamilrybinski/'>Kamil Rybinski</a></h3>
  </div>
  <div class='form'>
    <div class='form-header'>
      <p class="name">Login Form</p>
      <span class='fa fa-times close-icon'></span>
    </div>
    <div class='content'>
      <input type='text' id='username' name='username' placeholder='Username'>
      <input type='password' id='password' name='password' placeholder='Password'>
    </div>
    <div class='signin'>
      <div class='btnSignIn'>
        <h1>Sign In</h1>
      </div>
      <span class='lost'>Lost Your Password ?</span>
    </div>
  </div> <!-- close form -->
  <div class='info'>
     <div class='infoHeader'>
       <h1 class='infoH1'></h1>
    </div>
    <div class='infoContent'>
      <p class='infoP'></p>
    </div>
    <div class='closeSection'>
      <div class='btnClose'>
        <h1>Close</h1>
      </div>
    </div>
  </div> <!-- close info -->
</div>
              
            
!

CSS

              
                @import "lesshat";
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,700);

@bg-color: #39163b;
@owner-color: #3498db;
@header: #734d76;
@input: gray;
@input-color: #2c3e50;

.setGradient(@color1, @color2) {
  background: -webkit-linear-gradient(@color1, @color2); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(@color1, @color2); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(@color1, @color2); /* For Firefox 3.6 to 15 */
  background: linear-gradient(@color1, @color2); /* Standard syntax */
}

body { 
  background-color: @bg-color; 
  margin: 0;
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: #fff;
}

#container { 
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%; 
  height: 100vh; 
}

.about {
  .slogan {
    font-size: 30px;
    margin-bottom: 20px;
    text-align: center;
  }
  
  h1 {
    font-size: 14px;
    text-align: center;
    font-weight: 700;
  }
  
  .description {
    text-align: center;
    font-size: 13px;
    margin: 0;
  }
  
  .owner {
    margin-top: 15px;
    text-align: center;
    font-size: 10px;
    
    a {
      color: @owner-color;
      text-decoration: none;
    }
  }
}

.form {
  width: 360px;
  height: 330px;
  background-color: #fff;
  border-radius: 4px;
  margin-top: 10vh;
  
  .form-header {
    width: 100%;
    height: 70px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    position: relative;
      
    .setGradient(#78517B, #552E55);
    
    .name {
      font-size: 17px;
      font-weight: 300;
      float: left;
      margin-top: 25px;
      margin-left: 15px;
    }
    
    .close-icon {
      font-size: 20px;
      position: absolute;
      top: 25px;
      right: 15px;

      &:hover { cursor: pointer; }
    }
} // close header
  
.content {
  width: 100%;
  height: 150px;

  input {
    display: flex;
    justify-content: center;
    margin-left: 20px;
    width: 298px;
    height: 50px;
    border-radius: 4px;
    border: 1px solid lighten(@input, 20%);
    background-color: #ecf0f1;
    color: @input-color;
    outline: 0;

    &:nth-child(1) { margin-top: 35px; }
    &:nth-child(2) { margin-top: 20px; }
  }      

    input[placeholder] {
      padding-left: 15px;
      font-family: 'Raleway', sans-serif;
      font-size: 13px;
      font-weight: 300;
      color: @input-color;

      /* Set placeholders colors */
      &::-webkit-input-placeholder { color: @input-color; }
      &:-moz-placeholder  { color: @input-color; }
      &::-moz-placeholder { color: @input-color; }
      &:-ms-input-placeholder { color: @input-color; }
    }
  } // close content

.signin {
  width: 100%;
  height: 80px;

  .btnSignIn {
    width: 100px;
    height: 40px;
    border-radius: 4px;
    background-color: @header;
    margin-left: 20px;
    float: left;
    border: 1px solid @header;
    transition: all 0.5s ease-in-out;

    &:hover { 
      cursor: pointer; 
      background-color: #fff;
      color: @bg-color;
      border-color: @header;
    }

    h1 {
      font-size: 13px;
      text-align: center;
      padding-top: 5px;
    }
  }

  .lost {
    font-size: 12px;
    font-weight: 600;
    color: @input-color;
    float: left;
    padding-top: 14px;
    padding-left: 26px;
 
    &:hover { cursor: pointer; }
  }
  } // close signin
} // close form

.info {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  width: 400px;
  height: 180px;
  background-color: #FFF;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  box-shadow: 1px 1px 2px #000;

  .infoHeader {
    width: 100%;
    height: 40px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;

    .setGradient(#78517B, #552E55);

    h1 {
      font-family: Arial;
      font-size: 14px;
      font-weight: 600;
      color: #FFF;
      float: left;
      margin-top: 14px;
      margin-left: 20px;
      text-shadow: 0px 1px 1px #000;
    }
  } // close infoHeader

  .infoContent {
    width: 100%;
    height: 50px;

    p {
      font-family: Arial;
      font-size: 16px;
      font-weight: bold;
      text-align: center;
      margin-top: 30px;
      color: darken(@input, 20%);
    }
  } // close infoContent

  .closeSection {
    width: 100%;
    height: 40px;

    .btnClose {
      width: 100px;
      height: 40px;
      border-radius: 3px;
      background-color: @header;
      margin: 0 auto;

      &:hover { cursor: pointer; }

      h1 {
        font-family: Arial;
        font-size: 13px;
        font-weight: 600;
        text-align: center;
        color: #FFF;
        padding-top: 12px;
        text-shadow: 0px 1px 1px #000;
      }
    }
  } // close closeSection

}
              
            
!

JS

              
                var btnSignIn = $('.btnSignIn');
var btnClose = $('.btnClose');
var btnLost = $('.lost');

btnSignIn.click(function() {
  var login = $('#username');
  var pass = $('#password');
  var info = $('.info');
  var infoH1 = $('.infoH1');
  var infoP = $('.infoP');
  
  // Sign In button
  // Data validation
  if (login.val() == '' || pass.val() == '') {
    //info.fadeIn(300).css('display', 'block');
    info.fadeIn(300).css('display', 'block');
    infoH1.html('Validation Error');
    infoP.css('color', '#E53935');
    infoP.html('You have to fill both fields if you want to sign in.');
  } else if (login.val().length <= 3 || pass.val().length <= 3) {
    info.fadeIn(300).css('display', 'block');
    infoH1.html('Too short Password');
    infoP.css('color', 'red');
    infoP.html('Your login or password is too short.');
  } else {
    info.fadeIn(300).css('display', 'block');
    infoH1.html('Successfull');
    infoP.css('color', 'green');
    infoP.html('You are logged successfully.');
  }
});

// Lost Your Password
btnLost.click(function() {
  var info = $('.info');
  var infoH1 = $('.infoH1');
  var infoP = $('.infoP');
  
  info.fadeIn(300).css('display', 'block');
  infoH1.html('You have lost your password ?');
  infoP.css('color', '#1565C0');
  infoP.html('It\'s not my falut :)');
});

// Close button
btnClose.click(function() {
  var info = $('.info');
  var con = $('#container');
  
  info.fadeOut(300).css({
      'display': 'block'     
  });
  
});
              
            
!
999px

Console