JQ实现——TAB选项卡切换登录界面

柔光的暖阳◎ 2022-05-23 12:12 458阅读 0赞

今天,分享一个简单实用的TAB选项卡切换登录界面。
这里写图片描述
这里写图片描述

主页部分

  1. <!DOCTYPE html>
  2. <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <link rel="stylesheet" href="css/login.css"> <title>Login</title> </head> <body> <div class="section"> <div class="all"> <div class="nav"> <a class="login on">普通登陆</a> <a class="login">二维码登陆</a> </div> <div class="contentbox"> <div class="box active"> <div class="cont-1"> <input class="icon email" name="txt" type="text" placeholder="邮箱"> <input class="icon password" name="psd" type="password" placeholder="密码"> <div class="verify"> >>>请依次点击"敏","享","昔"完成验证>>> </div> <button class="btn">登 陆</button> <div class="about"><a href="#">忘记密码? <span></span> 注册 <span></span> 关于网易邮箱帐号</a></div> </div> </div> <div class="box"> <div class="cont-2"> <span class="text">使用 <a href="#">网易帐号管家</a><a href="#">邮箱大师</a> 扫一扫快速登陆</span> <img src="img/img2_01.png" width="190" height="190"> <div class="about"><a href="#">忘记密码? <span></span> 注册 <span></span> 关于网易邮箱帐号</a></div> </div> </div> </div> </div> </div> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> <script> $().ready(function(){ $(function(){ $(".nav a").off("click").on("click",function(){ var index = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); $(".contentbox .box").eq(index).addClass("active").siblings().removeClass("active"); }); }); }) </script> <!--[if lte IE 9]> <script src="https://cdn.bootcss.com/jquery-placeholder/2.3.1/jquery.placeholder.min.js"></script> <script> $(function(){ $('input[placeholder]').placeholder(); $('.password').css({"margin-top":"17px"}) }); </script> <![endif]--> </body> </html>

样式部分

  1. *{ margin: 0; padding: 0; box-sizing: border-box; }
  2. .section{ margin: 100px auto; width: 472px; height: 422px; background-color: #39a6eb; padding: 8px 10px; font-family: "Microsoft YaHei"; }
  3. .all{ width: 450px; height: 405px; }
  4. .nav{ height: 50px; }
  5. .nav>a{ padding: 0 15px; width: 225px; height: 50px; line-height: 50px; display: block; font-size: 18px; font-weight: bold; text-align: center; float: left; cursor: pointer; }
  6. .nav>a[class="on-2-login"]{ background-color: #89caf4; border-bottom: 1px solid #eee; }
  7. .login{ background-color: #89caf4; }
  8. .login.on{ background-color: #e1f2fc; }
  9. .contentbox{ width: 450px; }
  10. .cont-1>input{ width: 350px; height: 46px; border: 1px solid #c6cddc; }
  11. .email{ background-image: url("../img/img1-coin1_03.png"); background-repeat: no-repeat; background-position: 3px 0px; }
  12. .password{ background-image: url("../img/img1-coin2_03.png"); background-repeat: no-repeat; }
  13. .cont-1>input{ line-height: 46px; padding-left: 40px; }
  14. .cont-1>input[name="txt"]{ margin-top: 35px; }
  15. .cont-1>input[name="psd"]{ margin-top: 17px; }
  16. .verify{ margin: 0 auto; width: 352px; height: 40px; margin-top: 16px; border: 1px solid #c4cbd1; text-align: center; line-height: 40px; font-size: 12px; color: #b9bbb8; border-radius: 20px; position: relative; z-index: 2; behavior: url(PIE.htc); }
  17. .verify:hover{ cursor: pointer; }
  18. .btn{ width: 350px; height: 44px; background-color: #39a6eb; margin-top: 30px; font-size: 18px; color: #fff; }
  19. .btn:hover{ background-color: rgba(121,177,212,0.9); }
  20. .about{ width: 350px; height: 26px; font-size: 14px; margin: 0 auto; margin-top: 46px; }
  21. .about>a{ text-decoration: none; color: #4e6d99; }
  22. .about>a>span{ width: 1px; height: 12px; display: inline-block; border: 1px solid #ccd2d0; }
  23. /*cont:2*/
  24. .cont-2>.text{ margin: 0 auto; width: 350px; height: 30px; font-size: 15px; display: inline-block; margin-top: 30px; }
  25. .cont-2>.text>a{ text-decoration: none; color: #4174a9; font-weight: bold; }
  26. .cont-2>img{ margin-top: 12px; }
  27. .contentbox>div{ width: 450px; height: 355px; text-align: center; display: none; background-color: #e1f2fc; }
  28. .cont-2>.about{ margin-top: 54px; }
  29. .contentbox>div[class="box active"]{ display: block; }
  30. /*这是低端浏览器下placeholder的字体颜色*/
  31. .cont-1>input{ color: #bfbfbf; }
  32. /*这是firefox下placeholder的字体颜色*/
  33. .cont-1>input::-moz-placeholder { color: #bfbfbf; }
  34. /*这是webkit下placeholder的字体颜色*/
  35. .cont-1>input::-webkit-input-placeholder { color: #bfbfbf; }

发表评论

表情:
评论列表 (有 0 条评论,458人围观)

还没有评论,来说两句吧...

相关阅读