Beautiful Login Form

发布于 大漠

好久没有写案例了,今天邮件收到Team Dzyngiri 设计的Creating Beautiful Login Form。他这个案例用了很多CSS3效果,不过有些地方还是使用了图片和jQuery来实现。后来兴趣来了,我根据他的设计效果进行了一些修改。比如说,icon我使用了我们常用的@font-face来制作,icon显示与隐藏,他是通过jQuery来实现,我现在改了他的结构和样式,通过css来实现。感兴趣的同学可以对比一下两种方法的实现过程与区别。

demodownload

HTML CODE

<form name="login-form" class="login-form" action="" method="post">
  <div class="header">
    <h1>Login Form</h1>
    <span>Please login by using this beautiful login form or if you dont have an account, you can Register!</span>
  </div>
  <div class="content">
    <input name="username" type="text" class="input username" placeholder="Username" />
    <div class="icon-user" id="user-icon"></div>
    <input name="password" type="password" class="input password" placeholder="Password" />
    <div class="icon-pass" id="user-pass"></div>
  </div>
  <div class="footer">
    <input type="submit" name="submit" value="Login" class="button" />
    <input type="submit" name="submit" value="Register" class="register" />
  </div>
</form>

CSS CODE

html{
  height: 100%;
  background-color: #252326;
  background: 
   url('dots.png') center center fixed, 
   url('bg.jpg') center center no-repeat fixed;
   background-size: auto, cover;
}
body {
  font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  font-weight:300;
  text-align: left;
  text-decoration: none;
  overflow:hidden;
  background:none;
}
@font-face {
  font-family: 'broccolidry';
  src:url('fonts/broccolidry.eot');
  src:url('fonts/broccolidry.eot?#iefix') format('embedded-opentype'),
	url('fonts/broccolidry.svg#broccolidry') format('svg'),
	url('fonts/broccolidry.woff') format('woff'),
	url('fonts/broccolidry.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}


/* Use the following CSS code if you want to have a class per icon */
[class^="icon-"]:before, 
[class*=" icon-"]:before {
  font-family: 'broccolidry';
  font-style: normal;
  speak: none;
  font-weight: normal;
  line-height: 1;
  font-smoothing: antialiased;
  color: white;
  font-size: 20px;
  display: block;
  height: 47px;
  line-height: 47px;
  text-align: center;
}
.icon-pass:before {
  content: "\e000";
}
.icon-user:before {
  content: "\e001";
}


/*******************
LOGIN FORM
*******************/

.login-form {
  width: 300px;
  margin: 50px auto;
  position: relative;
  background: #f3f3f3;
  border: 1px solid #fff;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/*******************
HEADER
*******************/

.login-form .header {
  padding: 40px 30px 30px 30px;
}

.login-form .header h1 {
  font:300 28px/34px 'Denk One', sans-serif;
  color: #414848;
  text-shadow: 1px 1px 0 rgba(256,256,256,1.0);
  margin-bottom: 10px;
}

.login-form .header span {
  font-size: 11px;
  line-height: 16px;
  color: #678889;
  text-shadow: 1px 1px 0 rgba(256,256,256,1.0);
}

/*******************
CONTENT
*******************/

.login-form .content {
  padding: 0 30px 25px 30px;
}

.login-form .content .input {
  width: 188px;
  padding: 15px 25px;
  font:400 14px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  color: #9d9e9e;
  text-shadow: 1px 1px 0 rgba(256,256,256,1.0);
  background: #fff;
  border: 1px solid #fff;
  border-radius: 5px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.50);
}

.login-form .content .password, 
.login-form .content .icon-pass {
  margin-top: 25px;
}

.login-form .content .input:hover {
  background: #dfe9ec;
  color: #414848;
}

.login-form .content .input:focus {
  background: #dfe9ec;
  color: #414848;	
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}

[class^="icon-"] {
  width: 46px;
  height: 47px;
  display: block;
  position: absolute;
  left: 2000px;
  padding-right: 2px;
  z-index: 3;
  border-radius: 5px 0 0 5px;
  background:rgba(65, 72, 72, 0.75);
}

.icon-user {
  top:147px;
}

.icon-pass {
  top:221px;
}

.input, 
[class^="icon-"],
.button, 
.register {
  transition: all 0.5s;
}
input[type="text"]:focus ~ #user-icon,
input[type="password"]:focus ~ #user-pass {
  left:-49px;
}
/*******************
FOOTER
*******************/

.login-form .footer {
  padding: 25px 30px 40px 30px;
  overflow: auto;
  background: #d4dedf;
  border-top: 1px solid #fff;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.15);
}

/* Login button */
.login-form .footer .button {
  float:right;
  padding: 11px 25px;
  font:300 18px 'Denk One', sans-serif;
  color: #fff;
  text-shadow: 0px 1px 0 rgba(0,0,0,0.25);
  background: #56c2e1;
  border: 1px solid #46b3d3;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: inset 0 0 2px rgba(256,256,256,0.75);
}

.login-form .footer .button:hover {
  background: #3f9db8;
  border: 1px solid rgba(256,256,256,0.75);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.login-form .footer .button:focus {
  position: relative;
  bottom: -1px;
  background: #56c2e1;
  box-shadow: inset 0 1px 6px rgba(256,256,256,0.75);
}

/* Register button */
.login-form .footer .register {
  display: block;
  float: right;
  padding: 10px;
  margin-right: 20px;
  background: none;
  border: none;
  cursor: pointer;
  font:300 18px 'Denk One', sans-serif;
  color: #414848;
  text-shadow: 0px 1px 0 rgba(256,256,256,0.5);
}

.login-form .footer .register:hover {
  color: #3f9db8;
}

.login-form .footer .register:focus {
  position: relative;
  bottom: -1px;
}

demodownload

如需转载,烦请注明出处:https://www.fedev.cn/demo/beautiful-login-form.html

nike free run 5.0 style