表单/表格

分步式用户注册表单UI界面设计

阿里云

分步式用户注册表单UI界面设计
这是一款效果非常酷的分步式用户注册表单 UI 界面设计效果。在这个设计中简单的将用户注册分为 3 个步骤,用户填写完每一个步骤的信息后可以点击“下一步”按钮跳转到下一个步骤,也可以通过“前一步”按钮来查看前面的填写内容。在切换步骤的时候还带有非常炫酷的过渡动画效果。

HTML 结构

该分步式注册表单使用的 HTML 结构就是一个普通的<form>表单元素。每一个注册步骤都使用一个<fieldset>元素来包裹。

也想出现在这里?联系我们
创客主机
  1. <form id="msform">
  2.   <!-- progressbar -->
  3.   <ul id="progressbar">
  4.     <li class="active">账号设置</li>
  5.     <li>社交账号</li>
  6.     <li>个人详细信息</li>
  7.   </ul>
  8.   <!-- fieldsets -->
  9.   <fieldset>
  10.     <h2 class="fs-title">创建你的账号</h2>
  11.     <h3 class="fs-subtitle">这是第一步</h3>
  12.     <input type="text" name="email" placeholder="Email地址" />
  13.     <input type="password" name="pass" placeholder="密码" />
  14.     <input type="password" name="cpass" placeholder="重复密码" />
  15.     <input type="button" name="next" class="next action-button" value="Next" />
  16.   </fieldset>
  17.   <fieldset>
  18.     <h2 class="fs-title">填写社交账号</h2>
  19.     <h3 class="fs-subtitle">填写你的常用社交网络账号</h3>
  20.     <input type="text" name="x-weibo" placeholder="新浪微博" />
  21.     <input type="text" name="t-weibo" placeholder="腾讯微博" />
  22.     <input type="text" name="qq" placeholder="腾讯QQ" />
  23.     <input type="button" name="previous" class="previous action-button" value="Previous" />
  24.     <input type="button" name="next" class="next action-button" value="Next" />
  25.   </fieldset>
  26.   <fieldset>
  27.     <h2 class="fs-title">个人详细信息</h2>
  28.     <h3 class="fs-subtitle">个人详细信息是保密的,不会被泄露</h3>
  29.     <input type="text" name="fname" placeholder="昵称" />
  30.     <input type="text" name="lname" placeholder="姓名" />
  31.     <input type="text" name="phone" placeholder="电话号码" />
  32.     <textarea name="address" placeholder="家庭住址"></textarea>
  33.     <input type="button" name="previous" class="previous action-button" value="Previous" />
  34.     <input type="submit" name="submit" class="submit action-button" value="Submit" />
  35.   </fieldset>
  36. </form>

CSS 样式

该分步式用户注册表单的 CSS 样式非常简单。首先是 input 元素和按钮都被简单的进行了一些美化:

  1. /*inputs*/
  2. #msform input, #msform textarea {
  3.   padding: 15px;
  4.   border: 1px solid #ccc;
  5.   border-radius: 3px;
  6.   margin-bottom: 10px;
  7.   width: 100%;
  8.   box-sizing: border-box;
  9.   font-family: "Microsoft YaHei",montserrat;
  10.   color: #2C3E50;
  11.   font-size: 13px;
  12. }
  13. /*buttons*/
  14. #msform .action-button {
  15.   width: 100px;
  16.   background: #27AE60;
  17.   font-weight: bold;
  18.   color: white;
  19.   border: 0 none;
  20.   border-radius: 1px;
  21.   cursor: pointer;
  22.   padding: 10px 5px;
  23.   margin: 10px 5px;
  24. }
  25. #msform .action-button:hover, #msform .action-button:focus {
  26.   box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60;
  27. }

表单顶部的导航进度条的颜色显示效果使用了 CSS3 的 counter()函数来统计步骤,根据相应的步骤填充进度条的颜色。

  1. #progressbar {
  2.   margin-bottom: 30px;
  3.   overflow: hidden;
  4.   /*CSS counters to number the steps*/
  5.   counter-reset: step;
  6. }
  7. #progressbar li {
  8.   list-style-type: none;
  9.   color: white;
  10.   text-transform: uppercase;
  11.   font-size: 9px;
  12.   width: 33.33%;
  13.   float: left;
  14.   position: relative;
  15. }
  16. #progressbar li:before {
  17.   content: counter(step);
  18.   counter-increment: step;
  19.   width: 20px;
  20.   line-height: 20px;
  21.   display: block;
  22.   font-size: 10px;
  23.   color: #333;
  24.   background: white;
  25.   border-radius: 3px;
  26.   margin: 0 auto 5px auto;
  27. }

进度条本身使用的是无序列表 li 元素的:after 伪元素来制作。由于第一个元素是不需要前面的进度条的,所以设置通过#progressbar li:first-child:after 的 content 为 none 来取消它。

  1. #progressbar li:after {
  2.   content: '';
  3.   width: 100%;
  4.   height: 2px;
  5.   background: white;
  6.   position: absolute;
  7.   left: -50%;
  8.   top: 9px;
  9.   z-index: -1; /*put it behind the numbers*/
  10. }
  11. #progressbar li:first-child:after {
  12.   content: none; 
  13. }

当进度条处于激活状态时(当前步骤),进度条被设置为绿底白字。

  1. #progressbar li.active:before,  #progressbar li.active:after{
  2.   background: #27AE60;
  3.   color: white;
  4. }

JAVASCRIPT

在 jQuery 代码中,主要是处理“前一步”和“下一步”按钮的点击事件。该设计中使用 jquery.easing.js 来制作过渡动画效果。具体的代码请参考下载文件。

分步式用户注册表单 UI 界面设计

已有 665 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!