打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
jQuery和CSS3打造GOOGLE样式的用户登录界面

这是一款使用jQueryCSS3打造的GOOGLE样式的用户登录界面特效。该登录界面特效中,右上角的小问号和错误提示小图标使用SVG来制作,用户名和密码输入框采用浮动标签特效,可点击的按钮上使用了很酷的点击波特效。整个登录界面简洁大方,互动性很强。

该用户登录界面使用HTML5的标签来提示用户输入错误。

HTML结构

该GOOGLE样式用户登录界面的HTML结构使用标准的Form表单结构,图标使用标签来包裹一个SVG图形,错误信息则用来制作:

<div class="login">
  <i ripple>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
    <path fill="#C7C7C7" d="..."/>
    svg>
  i>
  <div class="photo">
  div>
  <span>Sign in with your Google Accountspan>
  <form action="" id="login-form">
    <div id="u" class="form-group">
      <input id="username" spellcheck=false class="form-control" name="username" type="text" size="18" alt="login" required="">
      <span class="form-highlight">span>
      <span class="form-bar">span>
      <label for="username" class="float-label">Emaillabel>
      <erroru>
        Username is required
        <i>  
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            ...
        svg>
        i>
      erroru>
    div>
    <div id="p" class="form-group">
      <input id="password" class="form-control" spellcheck=false name="password" type="password" size="18" alt="login" required="">
      <span class="form-highlight">span>
      <span class="form-bar">span>
      <label for="password" class="float-label">Passwordlabel>
      <errorp>
        Password is required
        <i>  
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            ...
        svg>
        i>
      errorp>
    div>
    <div class="form-group">
    <input type="checkbox" id="rem">
    <label for="rem">Stay Signed inlabel>
    <button id="submit" type="submit" ripple>Sign inbutton>
    div>
  form>
div>               

CSS样式

该登录界面的用户头像是使用CSS ::before::after伪元素制作的。

.login .photo {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 30px 135px;
  border-radius: 50%;
  background: rgb(223, 223, 223);
  border: 13px solid rgb(223, 223, 223);
  overflow: hidden !important;
  transform: rotate(-1deg);
}
.login .photo:before {
  position: absolute;
  content: '';
  width: 35px;
  height: 35px;
  top: 0px;
  right: 20px;
  border-radius: 50%;
  background: #aaa;
  border: 2px solid #fff;
  transform: scale(0);
  transition: 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  -webkit-animation: user-head 0.5s 0s forwards;
  -moz-animation: user-head 0.5s 0s forwards;
  animation: user-head 0.5s 0s forwards;
}
.login .photo:after {
  position: absolute;
  content: '';
  width: 140px;
  height: 220px;
  top: 38px;
  right: -32px;
  border-radius: 50%;
  background: #aaa;
  border: 2px solid #fff;
  transform: translateY(36px);
  transition: 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  -webkit-animation: user-body 0.5s 0.3s forwards;
  -moz-animation: user-body 0.5s 0.3s forwards;
  animation: user-body 0.5s 0.3s forwards;
}               

浮动标签float-label使用绝对定位,当输入框聚焦或:valid的时候,浮动标签使用指定的过渡动画向上移动。浮动标签是一个非常有创意的设计,想了解浮动标签的设计方式可以查看这里:CSS表单元素浮动标签的设计技巧与实现方法

.float-label {
  position: absolute;
  left: 0;
  top: 10px;
  font-size: 16px;
  color: #999;
  font-weight: 300;
  transition: 0.2s ease all;
  -moz-transition: 0.2s ease all;
  -webkit-transition: 0.2s ease all;
}
.form-control:focus ~ .float-label, .form-control:valid ~ .float-label {
  top: -15px;
  font-size: 12px;
}               

该登录界面中还使用了一个有趣的特效-点击波特效。当在按钮上点击的时候,一个光圈从被点击的点开始,会像冲击波一样向外辐射。在HTML代码中,每个带有点击波特效的元素都有一个自定义的属性ripple

[ripple] {
  position: relative;
  overflow: hidden;
  -webkit-transition: box-shadow .4s;
  -moz-transition: box-shadow .4s;
  -ms-transition: box-shadow .4s;
  -o-transition: box-shadow .4s;
  transition: box-shadow .4s;
  cursor: inherit;
}
[ripple] .touch {
  background: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  border-radius: 100%;
}              
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
How I made an iPhone 4 in CSS3
Create an SVG Animation using CSS and JavaScript
Amazing!!CSS 也能实现烟雾效果?
js+JQuery实现返回顶部功能
纯html5+css3下拉导航菜单实现代码
jQuery基本选择器及用法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服