# sign-up **Repository Path**: haiyongcsdn/sign-up ## Basic Information - **Project Name**: sign-up - **Description**: 简单的登陆注册 - **Primary Language**: HTML - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://haiyongcsdn.gitee.io/sign-up/ - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 0 - **Created**: 2021-03-07 - **Last Updated**: 2024-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 演示效果: 在下面,您可以看到我创建的演示: ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210307171501892.gif#pic_center) ---- 一个基于HTML,CSS,JS的登陆注册表单,文章中给出了完整的源码 --- ## 项目描述 在转到实际代码之前,我想对组件中要包含的内容进行分解。这将有所帮助,因为它将使我们编写的代码更加清晰。 我们在主要组件(`.container`)中有4个较小的屏幕/框: - 在登录形式 - 该会员注册表格 - 在登录覆盖 - 该会员注册覆盖 另外,您会在某一时刻看到以下任一情况: - 在登录形式旁会员注册覆盖 - 该会员注册的形式旁边的登录覆盖 在覆盖面板中,我们有一些文本和`button`---单击以显示其他屏幕组合,反之亦然。再检查一次以上的GIF,以了解我的意思。 ### 叠加动画-说明 这可能有点棘手,但我会尽力解释,以便您了解其背后的逻辑。 我们的叠加层组件具有以下几层: `overlay-container`---这将在特定时间显示可见区域(下面有更多信息)。它拥有width的50%全部容器的宽度。 叠加层-该div的width大小为两倍(200%),因此它占据了主容器的整个宽度。(`200% * 50%= 100%`。50%来自`.overlay-container`上面)。 覆盖面板s-是保存我们在屏幕上看到的实际内容(文本和按钮)的div。他们都有一个`position`的`absolute`- >这意味着我们可以定位他们的地方,我们要在`.overlay`组件。一个面板的被定位到`left`,而另一个被定位到`right`,两者都具有的宽度`50%`的`.overlay`成分。 ### 表格动画-说明 这些一点都不难理解。基本上,我们再次有两个容器-`.form-container`秒-每个具有width的50%和`position- absolute`。我们同时将它们从左向右移动,并且当它们`.overlay-container`从上方移到上方(当它们移动时)时,我们会快速更改该`z-index`值,以便“注册”表单(例如)将移到顶部签收表格,反之亦然。看起来很奇妙,但背后只是一些代码逻辑!😆 ## 演示地址 [https://haiyongcsdn.gitee.io/sign-up/](https://haiyongcsdn.gitee.io/sign-up/) ## 项目地址 [https://gitee.com/haiyongcsdn/sign-up](https://gitee.com/haiyongcsdn/sign-up) ## 代码展示 ### HTML ```html

Sign Up

Sign In

Forgot your password?
``` ### CSS ```css :root { /* COLORS */ --white: #e9e9e9; --gray: #333; --blue: #0367a6; --lightblue: #008997; /* RADII */ --button-radius: 0.7rem; /* SIZES */ --max-width: 758px; --max-height: 420px; font-size: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; } body { align-items: center; background-color: var(--white); background: url("https://res.cloudinary.com/dbhnlktrv/image/upload/v1599997626/background_oeuhe7.jpg"); background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; display: grid; height: 100vh; place-items: center; } .form__title { font-weight: 300; margin: 0; margin-bottom: 1.25rem; } .link { color: var(--gray); font-size: 0.9rem; margin: 1.5rem 0; text-decoration: none; } .container { background-color: var(--white); border-radius: var(--button-radius); box-shadow: 0 0.9rem 1.7rem rgba(0, 0, 0, 0.25), 0 0.7rem 0.7rem rgba(0, 0, 0, 0.22); height: var(--max-height); max-width: var(--max-width); overflow: hidden; position: relative; width: 100%; } .container__form { height: 100%; position: absolute; top: 0; transition: all 0.6s ease-in-out; } .container--signin { left: 0; width: 50%; z-index: 2; } .container.right-panel-active .container--signin { transform: translateX(100%); } .container--signup { left: 0; opacity: 0; width: 50%; z-index: 1; } .container.right-panel-active .container--signup { animation: show 0.6s; opacity: 1; transform: translateX(100%); z-index: 5; } .container__overlay { height: 100%; left: 50%; overflow: hidden; position: absolute; top: 0; transition: transform 0.6s ease-in-out; width: 50%; z-index: 100; } .container.right-panel-active .container__overlay { transform: translateX(-100%); } .overlay { background-color: var(--lightblue); background: url("https://res.cloudinary.com/dbhnlktrv/image/upload/v1599997626/background_oeuhe7.jpg"); background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; height: 100%; left: -100%; position: relative; transform: translateX(0); transition: transform 0.6s ease-in-out; width: 200%; } .container.right-panel-active .overlay { transform: translateX(50%); } .overlay__panel { align-items: center; display: flex; flex-direction: column; height: 100%; justify-content: center; position: absolute; text-align: center; top: 0; transform: translateX(0); transition: transform 0.6s ease-in-out; width: 50%; } .overlay--left { transform: translateX(-20%); } .container.right-panel-active .overlay--left { transform: translateX(0); } .overlay--right { right: 0; transform: translateX(0); } .container.right-panel-active .overlay--right { transform: translateX(20%); } .btn { background-color: var(--blue); background-image: linear-gradient(90deg, var(--blue) 0%, var(--lightblue) 74%); border-radius: 20px; border: 1px solid var(--blue); color: var(--white); cursor: pointer; font-size: 0.8rem; font-weight: bold; letter-spacing: 0.1rem; padding: 0.9rem 4rem; text-transform: uppercase; transition: transform 80ms ease-in; } .form > .btn { margin-top: 1.5rem; } .btn:active { transform: scale(0.95); } .btn:focus { outline: none; } .form { background-color: var(--white); display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 0 3rem; height: 100%; text-align: center; } .input { background-color: #fff; border: none; padding: 0.9rem 0.9rem; margin: 0.5rem 0; width: 100%; } @keyframes show { 0%, 49.99% { opacity: 0; z-index: 1; } 50%, 100% { opacity: 1; z-index: 5; } } ``` JS ```javascript const signInBtn = document.getElementById("signIn"); const signUpBtn = document.getElementById("signUp"); const fistForm = document.getElementById("form1"); const secondForm = document.getElementById("form2"); const container = document.querySelector(".container"); signInBtn.addEventListener("click", () => { container.classList.remove("right-panel-active"); }); signUpBtn.addEventListener("click", () => { container.classList.add("right-panel-active"); }); fistForm.addEventListener("submit", (e) => e.preventDefault()); secondForm.addEventListener("submit", (e) => e.preventDefault()); ``` 以上就是所有代码了,CV一下这酷炫的登陆注册表单你也可以拥有,或者也可以用以下方式下载。 ## 1.CSDN积分下载 [https://download.csdn.net/download/qq_44273429/15636850](https://download.csdn.net/download/qq_44273429/15636850) ## 2.关注公众号免费下载 关注作者微信公众号`啦啦啦好想biu点什么`回复`登陆注册表单`免费获取 保存或者长按识别 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210123111950829.jpg#pic_center) 后面我还会持续更新类似免费好玩的H5小游戏、Java小游戏、好玩、实用的项目和软件等等 ## 相关内容 - [勇敢的兔子疯狂奔跑小游戏](https://mp.weixin.qq.com/s/h-F1Yx3LAMVKsvDpTTKjbg) - [用HTML实现简单的下雪特效](http://mp.weixin.qq.com/s?__biz=Mzg5OTU2NTQ4MQ==&mid=2247484065&idx=1&sn=17a958a2a8df8458bf316fac55f865f3&chksm=c0501067f7279971add268cff499833f173c5d7368040c8c902da698eb72bdba23d10aca385a#rd) - [基于HTML/CSS/JS的动态元素周期表](https://blog.csdn.net/qq_44273429/article/details/114296024) - [基于HTML/CSS/JS的爱吹风的狮子小游戏](https://blog.csdn.net/qq_44273429/article/details/113792583) - [100个最常问的JavaScript面试问答](https://blog.csdn.net/qq_44273429/article/details/114240168) - [java五子棋小游戏含免费源码](https://mp.weixin.qq.com/s?__biz=Mzg5OTU2NTQ4MQ==&mid=2247483719&idx=1&sn=8c86ff28a782c838a184a4050c695d26&chksm=c0501381f7279a97df8f4467203e8de05ef7fd34f1d9be51a11c591c8e37e244cb010c55afda&token=925595149&lang=zh_CN#rd) - [一个炫光效果的酷炫登录表单](https://blog.csdn.net/qq_44273429/article/details/113797520) 最后,不要忘了❤或📑支持一下哦