div+js+css实现登录注册表单翻转切换效果代码
代码语言:html
所属分类:表单美化
代码描述:div+js+css实现登录注册表单翻转切换效果代码
代码标签: div js css 登录 注册 表单 翻转 切换
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap"); :root { color-scheme: "dark"; --body-rotate: rotateY(0deg); --background-position: 0 0; --body-height: 380px; --login-display: flex; } * { padding: 0; margin: 0; user-select: none; } html { font-size: 62.5%; } .d-none { display: none !important; } body { background-image: url(""); width: 100vw; min-height: 100vh; background-repeat: repeat; overflow: hidden; display: flex; justify-content: center; align-items: center; transition: background-position 1s; background-position: var(--background-position); } body * { font-family: "Poppins", sans-serif; } .container { width: 380px; display: flex; flex-direction: column; align-items: center; perspective: 1000px; } @media screen and (max-width: 385px) { .container { width: 95%; } } .container .header { width: 100%; height: auto; display: flex; flex-direction: column; align-items: center; margin-bottom: 15px; } .container .body { width: 100%; height: var(--body-height); position: relative; transform-style: preserve-3d; transition: transform 0.8s, height 0.5s; transform: var(--body-rotate); box-shadow: 0px 0px 4px 5px #163352; border-radius: 5px; } .header .header-titles { font-size: 1.8rem; color: #fff; width: 100%; display: flex; justify-content: center; font-weight: bold; user-select: none; text-shadow: 0px 0px 3px #fff; } .header .header-titles span:nth-child(1) { margin-right: 25px; } .header #header-toggler-checkbox { display: none; } .header #header-toggler-checkbox:checked ~ label[for=header-toggler-checkbox] .header-toggler-circle { left: 90%; transform: translate(-50%, -50%) rotate(90deg); } .header .header-toggler { width: 40px; height: 20px; border-radius: 10px; background-color: transparent; box-shadow: 0px 0px 1px 1px #0d6efd; margin-top: 10px; position: relative; cursor: pointer; } .header .header-toggler .header-toggler-circle { width: 25px; height: 25px; background-color: #0d6efd; border-radius: 50%; position: absolute; top: 50%; left: 10%; transform: translate(-50%, -50%); transition: left 0.4s, transform 0.4s 0.1s; display: flex; justify-content: center; align-items: center; } .header .header-toggler .header-toggler-circle .toggler-arrow-icon { width: 18px; stroke: #fff; stroke-width: 2px; } .body .form-wave { position: absolute; bottom: 0; transform: rotate(180deg); height: 120px; width: 200%; } .body .login-container { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 5px; overflow: hidden; background: #26425f; } .body .login-container .login-content, .body .login-container .signup-content { position: absolute; width: 100%; height: 100%; padding: 5px; } .body .signup-container { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 5px; overflow: hidden; background: #26425f; transform: rotateY(180deg); } .body .signup-container .signup-content { position: absolute; width: 100%; height: 100%; padding: 5px; } .login-content, .signup-content { display: var(--login-display); flex-direction: column; align-items: center; } .login-content .login-header, .signup-content .login-header, .signup-content .signup-header { text-align: center; margin-top: 10px; } .login-content .login-header .login-header-icon, .signup-content .login-header .login-header-icon, .signup-content .signup-header .login-header-icon, .signup-content .signup-header .signup-header-icon { display: inline-block; border: 2px solid rgba(255, 255, 255, 0.5); border-bottom-color: transparent; border-radius: 50%; padding: 10px; } .login-content .login-header .login-header-icon svg, .signup-content .login-header .login-header-icon svg, .signup-content .signup-header .login-header-icon svg, .signup-content .signup-header .signup-header-icon svg { width: 32px; } .login-content .login-input-container, .signup-content .login-input-container, .signup-content .signup-input-container { display: flex; align-items: center; flex-direction: column; width: 75%; } @media screen and (max-width: 450px) { .login-content .login-input-container, .signup-content .login-input-container, .signup-content .signup-input-container { width: 85%; } } .login-content .forget-password, .signup-content .forget-password { width: 92%; text-align: left; padding: 4px; font-size: 1.15rem; color: #617ac7; cursor: pointer; } .login-input, .signup-input { display: flex; justify-content: flex-start; align-items: center; background-color: transparent; border: 2px solid rgba(255, 255, 255, 0.1); padding: 10px; box-sizing: border-box; border-radius: 100px; width: 100%; height: 45px; margin-top: 15px; transition: box-shadow 0.3s; } .login-input .login-input-icon, .signup-input .login-input-icon, .signup-input .signup-input-icon { width: auto; height: auto; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 50%; width: 27px; height: 27px; transform: scale(1.2); transition: transform 0.1s; display: flex; justify-content: center; align-items: center; box-sizing: border-box; position: relative; } .login-input .login-input-icon svg, .signup-input .login-input-icon svg, .signup-input .signup-input-icon svg { width: 17px; stroke-width: 2px; stroke: rgba(255, 255, 255, 0.7); } .login-input .login-input-input, .signup-input .login-input-input, .signup-input .signup-input-input { width: 80%; background-color: transparent; font-size: 1.6rem; color: rgba(255, 255, 255, 0.9); padding-left: 10px; outline: none; border: none; } .login-input .login-input-input::placeholder, .signup-input .login-input-input::placeholder, .signup-input .signup-input-input::placeholder { color: rgba(255, 255, 255, 0.4); transition: color 0.1s; } .login-input .login-input-input:focus::placeholder, .signup-input .login-input-input:focus::placeholder, .signup-input .signup-input-input:focus::placeholder { color: transparent; } .login-button-container, .signup-button-container { margin-top: 15px; } .login-button-container .login-button, .signup-button-container .login-button, .signup-button-container .signup-button { width: 120px; height: 40px; background-color: #0E2A47; border: none; outline: none; color: rgba(255, 255, 255, 0.9); border-radius: 5px; font-size: 1.4rem; cursor: pointer; box-shadow: 0px 0px 20px 1px #0E2A47; transition: box-shadow 0.3s; display: flex; justify-content: center; align-items: center; } .login-button-container .login-button .login-button-title, .signup-button-container .login-button .login-button-title, .signup-button-container .signup-button .login-button-title, .signup-button-container .signup-button .signup-button-title { position: relative; left: 10px; transition: left 0.2s; } .login-button-container .login-button .login-button-icon, .signup-button-container .login-button .login-button-icon, .signup-button-container .signup-button .login-button-icon, .signup-button-container .signup-button .signup-button-icon { width: 17px; stroke: rgba(255, 255, 255, 0.9); stroke-width: 2px; margin-left: 4px; margin-top: 6px; opacity: 0; transition: opacity 0.7s; } .login-button-container .login-button:hover, .signup-button-container .login-button:hover, .signup-button-container .signup-button:hover, .login-button-container .login-button:focus, .signup-button-container .login-button:focus, .signup-button-container .signup-button:focus { box-shadow: 0px 0px 25px 5px #0E2A47; } .login-button-container .login-button:hover .login-button-icon, .login-button-container .login-button:hover .signup-button-container .signup-button .signup-button-icon, .signup-button-container .login-button:hover .login-button-icon, .signup-button-container .login-button:hover .signup-button .signup-button-icon, .signup-button-container .signup-button .login-button:hover .signup-button-icon, .signup-button-container .signup-button:hover .login-button-icon, .signup-button-container .signup-button:hover .signup-button-icon, .login-button-container .login-button:focus .login-button-icon, .login-button-container .login-button:focus .signup-button-container .signup-button .signup-button-icon, .signup-button-container .login-button:focus .login-button-icon, .signup-button-container .login-button:focus .signup-button .signup-button-icon, .signup-button-container .signup-button .login-button:focus .signup-button-icon, .signup-button-container .signup-button:focus .login-button-icon, .signup-button-container .signup-button:focus .signup-button-icon { opacity: 1; } .login-button-container .login-button:hover .login-button-title, .login-button-container .login-button:hover .signup-button-container .signup-button .signup-button-title, .signup-button-container .login-button:hover .login-button-title, .signup-button-container .login-button:hover .signup-button .signup-button-title, .signup-button-container .signup-button .login-button:hover .signup-button-title, .signup-button-container .signup-button:hover .login-button-title, .signup-button-container .signup-button:hover .signup-button-title, .login-button-container .login-button:focus .login-button-title, .login-button-container .login-button:focus .signup-button-container .signup-button .signup-button-title, .signup-button-container .login-button:focus .login-button-title, .signup-button-container .login-button:focus .signup-button .signup-button-title, .signup-button-container .signup-button .login-button:focus .signup-button-title, .signup-button-container .signup-button:focus .login-button-title, .signup-button-container .signup-button:focus .signup-button-title { left: 0; } .signup-content { display: flex; } .signup-content .signup-header .signup-header-icon svg { width: 32px; } .signup-button-container { margin-top: 20px; } .login-input-icon.focused-icon, .signup-input .focused-icon.signup-input-icon { transform: scale(1.4); border-color: rgba(255, 255, 255, 0.1); } .signup-input-icon.focused-icon { transform: scale(1.4); border-color: rgba(255, 255, 255, 0.1); } .input-focused { box-shadow: 0px 0px 3px 2px rgba(255, 255, 255, 0.15); } </style> </head> <body> <!-- partial:index.partial.html --> <div class="container"> <!-- header --> <header class="header"> <div class="header-titles"> <span class="header-title-login">LUL.BZ</span> <span class="header-title-signup">LUL.IS</span> </div> <input type="checkbox" id="header-toggler-checkbox"> <label for="header-toggler-checkbox"> <div class="header-toggler"> <div class="header-toggler-circle"> <svg class="toggler-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"> <line x1="17" y1="17" x2="7" y2="7"></line> <polyline points="7 17 7 7 17 7"></polyline> </svg> </div> </div> </label> </header> <!-- body --> <section class="body"> <!-- login --> <div class="login-container"> <div class="login-content"> <div class="login-header"> <div class="login-header-icon"> <?xml version="1.0" encoding="iso-8859-1"?> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 181.42 181.42" style="enable-background:new 0 0 181.42 181.42;" xml:space="preserve"> <g> <g> <path fill="rgba(255,255,255,.7)" d="M166.385,173.853c-7.344-2.606-21.492-7.443-36.275-11.477l-1.853-14.791c-0.244-1.952-1.902-3.413-3.866-3.413h-2.062 V126.68c4.33-5.259,8.01-11.644,10.769-18.687c2.203-0.026,4.334-0.75,6.127-2.101c2.218-1.678,3.657-4.129,4.045-6.899 l2.241-15.94c0.392-2.778-0.316-5.537-1.998-7.763c-1.179-1.564-2.74-2.74-4.517-3.429c-0.213-6.203-1.02-12.298-2.405-18.17 c0.194-1.644,0.293-3.311,0.293-4.958c0-14.494-7.401-27.736-19.928-35.899c0.32-4.543-0.476-7.858-2.405-10.088 C113.463,1.495,111.483,0,108.222,0c-7.485,0-18.68,3.489-24.924,5.658c-22.154,3.368-38.81,21.819-38.81,43.075 c0,1.648,0.099,3.314,0.293,4.958c-1.393,5.913-2.203,12.055-2.409,18.307c-4.345,1.724-7.127,6.271-6.446,11.115l2.222,15.799 c0.719,5.126,5.073,8.862,10.076,8.954c2.767,7.093,6.461,13.524,10.818,18.813v17.493h-2.036c-1.963,0-3.623,1.465-3.866,3.413 l-1.849,14.791c-14.821,4.041-28.935,8.866-36.256,11.469c-2.028,0.723-3.086,2.949-2.367,4.977 c0.719,2.024,2.953,3.078,4.977,2.367c7.626-2.709,22.725-7.869,38.185-11.964c1.537-0.407,2.671-1.709,2.869-3.284l1.747-13.977 h2.492h55.492h2.519l1.75,13.977c0.198,1.575,1.332,2.877,2.869,3.284c15.415,4.087,30.556,9.254,38.205,11.971 c0.434,0.152,0.871,0.224,1.305,0.224c1.602,0,3.105-0.997,3.672-2.591C169.472,176.802,168.414,174.573,166.385,173.853z M115.486,122.696c-0.616,0.712-0.955,1.617-0.955,2.557v18.92H66.837v-0.001v-18.92c0-0.94-0.339-1.845-0.955-2.557 c-4.757-5.472-8.703-12.538-11.408-20.434c-0.346-1.001-1.081-1.819-2.039-2.268c-0.963-0.449-2.062-0.483-3.048-0.106 c-0.209,0.084-0.407,0.133-0.613,0.164c-1.427,0.194-2.702-0.776-2.907-2.222L43.644,82.03c-0.202-1.446,0.757-2.736,2.523-2.961 c0.019,0,0.034,0,0.049,0c1.024,0,2.009-0.403,2.736-1.123c0.742-0.734,1.161-1.731,1.161-2.77 c0.004-6.979,0.814-13.821,2.412-20.339c0.114-0.479,0.141-0.97,0.076-1.457c-0.213-1.537-0.32-3.101-0.32-4.646 c0-17.527,13.977-32.752,32.508-35.415c0.247-0.038,0.495-0.099,0.734-0.183c9.695-3.395,17.968-5.343,22.697-5.343 c0.297,0,0.418,0.046,0.426,0.046c0.034,0.042,1.062,1.286,0.312,6.473c-0.224,1.575,0.529,3.132,1.91,3.931 c11.408,6.591,18.219,17.987,18.219,30.491c0,1.545-0.106,3.109-0.32,4.646c-0.065,0.487-0.038,0.982,0.076,1.457 c1.591,6.48,2.401,13.284,2.412,20.217c0,1.039,0.601,2.051,1.34,2.782c0.742,0.731,1.994,1.282,2.964,1.134 c0.696,0.099,1.309,0.457,1.728,1.008c0.426,0.567,0.605,1.271,0.502,1.986l-2.241,15.944c-0.099,0.715-0.464,1.34-1.028,1.766 c-0.552,0.418-1.256,0.582-1.948,0.498c-0.209-0.03-0.403-0.08-0.586-0.152c-0.989-0.399-2.093-0.373-3.067,0.076 c-0.966,0.445-1.713,1.267-2.059,2.272C124.155,110.222,120.22,117.25,115.486,122.696z"/> </g> </g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> <g></g> </svg> </div> </div> <!-- login inputs --> <div class="login-input-container"> <div class="login-input"> <div class="login-input-icon input-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path> <circle cx="12" cy="7" r="4"></circle> </svg> </div> <input type="text" class="login-input-input input" autocomplete="off" spellcheck="false" placeholder="Username" maxlength="15"> </div> <div class="login-input"> <div class="login-input-icon input-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="non.........完整代码请登录后点击上方下载按钮下载查看
网友评论0