abstract:HTML<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小米商城-登錄</title> <link rel="shortcut icon" type=&q
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小米商城-登錄</title> <link rel="shortcut icon" type="image/x-icon" href="static/images/footlogo.png"> <link rel="stylesheet" type="text/css" href="static/css/login.css"> <link rel="stylesheet" type="text/css" href="static/layui/css/layui.css"> <link rel="stylesheet" type="text/css" href="static/font-awesome/css/font-awesome.min.css"> <script src="static/layui/layui.js"></script> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> </head> <body> <div class="header"> <a href="./index.html"><img src="static/images/5.png"></a> </div> <div class="content"> <div class="login-content"> <div class="login-form"> <div class="login-form-main"> <p style="color: #ff6700;" id="tab_0" onclick="change(0,'tag_',1)">賬號(hào)登錄</p><span>|</span><P id="tab_1" onclick="change(1,'tag_',1)">掃碼登錄</P> </div> <div class="clear"></div> <!-- 賬號(hào)密碼登錄或注冊(cè) --> <div class="login-form-content" id="tag_0"> <form> <input type="text" name="username" placeholder="郵箱/ 手機(jī)號(hào)碼/ 小米ID/" autocomplete="off"> <input type="password" name="password" placeholder="密碼"> <button>登錄</button> </form> <h6> <a href="" style="color: #ff6700;">手機(jī)短信登錄/注冊(cè)</a> <span><a href="">立即注冊(cè)</a> | <a href="">忘記密碼</a></span> </h6> <div class="login-form-pic"> <p>其他方式登錄</p> <ul> <li class="pic1" style="margin-right: 35px;"><i class="fa fa-qq"></i></li> <li class="pic2" style="margin-right: 35px;"><i class="fa fa-weibo"></i></li> <li class="pic3" style="margin-right: 35px;"><i class="fa fa-twitter-square"></i></li> <li class="pic4"><i class="fa fa-weixin"></i></li> </ul> </div> </div> <!-- 使用掃碼登錄 --> <div class="login-form-content0" style="display: none;" id="tag_1"> <img src="static/images/download.png"> <p>使用<span style="color: #ff6700;">小米商城APP</span>掃一掃</p> <p>小米手機(jī)可打開[設(shè)置] > [小米賬號(hào)] 掃碼登錄</p> </div> </div> </div> </div> <p style="margin-top: 60px;">簡(jiǎn)體<span>|</span>繁體<span>|</span>English<span>|</span> 常見問題<span>|</span> 私隱政策</p> <p>小米公司版權(quán)所有-京ICP備10046111-<img src="static/images/ghs.png"> 京公網(wǎng)安備21012142124號(hào)-京ICP證121212號(hào)</p> </body> </html> <script type="text/javascript"> // 賬號(hào)登錄或掃碼登錄之間切換 js寫法 function change(num1,tag,num2){ for(var i=0;i<=num2;i++){ document.getElementById(tag+i).style.display = 'none'; } document.getElementById(tag+num1).style.display = 'block'; if(num1==0){ document.getElementById('tab_0').style.color = '#ff6700'; document.getElementById('tab_1').style.color = '#757575'; } if(num1==1){ document.getElementById('tab_1').style.color = '#ff6700'; document.getElementById('tab_0').style.color = '#757575'; } } // 賬號(hào)登錄或掃碼登錄之間切換 jQ寫法 // $('#tab_1').click(function(){ // $('#tag_0').hide(); // $('#tag_1').show(); // $('#tab_1').css('color','#ff6700'); // $('#tab_0').css('color','#757575'); // }); // $('#tab_0').click(function(){ // $('#tag_1').hide(); // $('#tag_0').show(); // $('#tab_0').css('color','#ff6700'); // $('#tab_1').css('color','#757575'); // }); </script>
CSS
*{margin: 0; padding: 0;} li{list-style: none;} a{text-decoration: none;color: #ccc;cursor: pointer;} .clear{clear: both;} .header{width: 1226px;height: 100px;margin: 0px auto;line-height: 90px;} .content{width: 100%;height: 580px;background: url(../images/login.png) no-repeat center;} .login-content{width: 1226px;height: 560px;margin: 0 auto;} .login-form{width: 410px;height: 520px;background: #fff;float: right;margin: 30px 50px;} .login-form-main{width: 330px;margin: 25px auto;} .login-form-main p{font-size: 23px;text-align: center;float: left;color: #757575;width: 150px; height: 50px;line-height: 50px;font-weight: bold;} .login-form-main span{font-size: 30px;float: left;height: 50px;line-height: 50px;color: #e0e0e0;} .login-form-content{margin-top: 25px;/*display: none;*/} .login-form-content input{border: 0;width: 328px;height: 28px;padding: 11px;margin: 15px auto; border: 1px solid #e0e0e0;display: block;} .login-form-content button{border: none;width: 300px;height: 50px;margin: 25px auto; display: block;background: #ff6700;color: #fff;} .login-form-content h6{font-weight: 300;width: 350px;margin: 0px auto;height: 40px;line-height: 40px;} .login-form-content span{float: right;color: #ccc;} .login-form-pic{width: 350px;margin: 100px auto 0px;border-top: 1px solid #e0e0e0; position: relative;} .login-form-pic p{width: 100px;height: 30px;line-height: 30px;color: #ccc;background: #fff; position: absolute;top: -14px;left: 125px;} .login-form-pic ul{width: 233px;margin: 20px auto 0px;} .login-form-pic ul li{float: left;height: 32px;width: 32px;line-height: 34px;color: #fff; text-align: center;border-radius: 16px;background: #6d6e6a;} .login-form-pic ul li i{font-size: 17px;} .login-form-pic .pic1:hover{background: #000;cursor: pointer;} .login-form-pic .pic2:hover{background: #ff6700;cursor: pointer;} .login-form-pic .pic3:hover{background: skyblue;cursor: pointer;} .login-form-pic .pic4:hover{background: lightgreen;cursor: pointer;} .login-form-content0{width: 350px;margin: 0px auto;text-align: center;} .login-form-content0 img{height: 190px;width: 180px;margin: 70px auto 15px;} .login-form-content0 p{width: 350px;margin: 0px auto;height: 20px;line-height: 20px;} p{width: 1226px;height: 38px;line-height: 38px;text-align: center;color: #757575;} span{font-size: 13px;margin: 0px 10px;}
效果圖
Correcting teacher:韋小寶Correction time:2019-02-25 11:56:02
Teacher's summary:不錯(cuò)不錯(cuò) 以假亂真 寫的很棒 這種登錄切換的功能在實(shí)際的網(wǎng)站中是很常見的