最近在尝试作网盘,使用的技术栈大概是 .net core + MVC + Mysql + Layui,主要目的是经过这个具体的项目,熟悉熟悉 .net core 开发,.net 的将来就是他了!javascript
在完成后端的一部分 建设 以后,我把目光投向了前端——登录注册,因为这个网盘是用来试手的我的项目,我并不想用曾经用过的制做方式——登陆和注册界面分开来作。我试图讲这两个功能合到一个页面上,而且以一种不是很 "Low" 的方式呈现出来。css
你也能够认为我只是单纯的懒,不想再多搞一个页面html
因此排除了曾经使用过的点击按钮跳出 登陆/注册 表单,排除了比较僵硬的使用选项卡切换 登陆/注册 以后,我瞄上了 翻转 效果。前端
看到那个 sign up 和 log in 以后我就想到,拿这两个超连接作点文章或许是不错的选择java
用户点击 sign up 以后从登陆翻转到注册,点击 log in 从注册翻转到登陆sql
从技术上来讲应该是不难的,可是 B 格 看起来马上就高了很多啊!!!!后端
具体效果能够直接拉到最下面字体
Htmlui
<body> <div class="mainbody middle"> <form class="form-box front"> <div> <h1>Login</h1> </div> <div> <input class="input-normal" type="text" placeholder="UserAccount" /> <input class="input-normal" type="password" placeholder="PassWord" /> <button class="btn-submit" type="submit"> LOGIN </button> </div> <div> <p style="margin-top: 40px">If you don't have account.Please</p> <p>Click here to <a id="signin">Sign Up</a></p> </div> </form> <!-- 对的你没看错,上下两个表单基本上没区别,一个front,一个back --> <form class="form-box back"> <div> <h1>Register</h1> </div> <div> <input class="input-normal" type="text" placeholder="UserAccount" /> <input class="input-normal" type="password" placeholder="PassWord" /> <button class="btn-submit" type="submit"> Register </button> </div> <div> <p style="margin-top: 40px">Have a account ? You can</p> <p>Click here to <a id="login">Log in</a></p> </div> </form> </div> </body>
Css.net
body { /*颜色这个看我的喜爱*/ background: darkslategrey; /*字体这个看我的喜爱*/ font-family: sans-serif; } /*主要是规定中间表单尺寸,调整到本身以为好看就好了*/ .mainbody { height: 440px; width: 400px; } /*居中效果*/ .middle { /*使左上角对应到父元素的中心*/ top: 50%; left: 50%; position: absolute; /*向左向上偏移50%*/ transform: translate(-50%, -50%); } .form-box { width: 100%; height: 100%; margin: auto; background: darkcyan; /* 我以为这个圆角大小刚恰好 */ border-radius: 40px; } .input-normal { width: 220px; height: 38px; margin: 30px auto; padding: 0; text-align: center; border-radius: 20px; outline: none; display: block; transition: 0.3s; border: 1px solid #e6e6e6; } .btn-submit { width: 100px; height: 36px; margin: auto; font-size: 18px; text-align: center; color: white; border-radius: 20px; display: block; background: darkslategrey; transition: 0.3s; } .front { transform: rotateY(0deg); } /* 将back旋转180度,背面朝向用户,我这边选y轴的 */ .back { transform: rotateY(-180deg); } .front, .back { position: absolute; /* 而后设置为背面朝向用户时不可见 */ backface-visibility: hidden; /* 我以为用linear顺滑一点 */ transition: 0.3s linear; } /* 将front旋转180度 */ .middle-flip .front { transform: rotateY(180deg); } /* 将back旋转180度 */ .middle-flip .back { transform: rotateY(0deg); } /* 我调整了一下,感受还不错的样式,你能够改为其余的好看点的 */ p { margin: 15px auto; padding: 0; font-size: 16px; color: white; display: block; text-align: center; } a { color: aqua; cursor: pointer; }
js
// 点击sigup触发翻转样式 $("#sigup").click(function() { $(".middle").toggleClass("middle-flip"); }); // 点击login触发翻转样式 $("#login").click(function() { $(".middle").toggleClass("middle-flip"); });
看起来好像还行的样子啊
能够考虑在 transfrom
后面加点 perspective
,加强立体感
我用的 perspective(600px)
无论大家怎么想,反正我以为这个效果仍是挺绿的