react密码强度输入检测效果代码
代码语言:html
所属分类:表单美化
代码描述:react密码强度输入检测效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); :root { --dark-green: hsl(147, 26%, 27%); --green: hsl(148, 26%, 48%); --light-green: hsl(149, 34%, 88%); --white: hsl(0, 0%, 100%); --space: 20px; --color: hsl(0, 0%, 20%); --color-focus: hsl(0, 0%, 50%); --transition: all 0.2s ease-out; } *, *:before, *:after { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } html { box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; line-height: 1; color: var(--color); } .App { min-height: 100vh; background-size: cover; background-repeat: no-repeat; background-position: center center; font-family: 'Montserrat', sans-serif; letter-spacing: 0.4px; } .github-button { position: absolute; display: inline-block; padding: 12px 14px; color: var(--white); background: #222; text-decoration: none; border-radius: 4px; right: 4%; top: 4%; font-size: 14px; font-weight: 600; } .form-box { width: 320px; max-width: 320px; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); display: -webkit-box; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; } .validation-box { padding: var(--space); background: var(--dark-green); margin-bottom: var(--space); border-radius: 8px; box-shadow: 0px 10px 43px 0px rgba(0, 0, 0, 0.12); list-style: none; font-size: 0.875em; font-weight: 600; color: var(--white); } .validation-item { position: relative; padding-left: calc(var(--space) + 8px); } .validation-item:not(:last-child) { margin-bottom: 16px; } .validation-item.done { color: hsla(0, 0%, 100%, 40%); } .validation-icon { position: absolute; width: 14px; height: 14px; display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; left: 0px; } .check { stroke-dasharray: 45; stroke-dashoffset: 45; -webkit-animation: check 0.2s 0.1s ease-in-out forwards; animation: check 0.2s 0.1s ease-in-out forwards; } @-webkit-keyframes check { 0% { stroke-dashoffset: 45; } 100% { stroke-dashoffset: 20; } } @keyframes check { 0% { stroke-dashoffset: 45; } 100% { stroke-dashoffset: 20; } } .form-field { display: -webkit-box; display: flex; position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0px 10px 43px 0px rgba(0, 0, 0, 0.12); } .form-field:active { -webkit-transform: scale(0.98); transform: scale(0.98); -webkit-transition: var(--transition); transition: var(--transition); } .form-input { padding-left: var(--space); padding-bottom: 2px; padding-top: 25px; padding-right: 80px; width: 100%; font-size: 18px; font-family: 'fontello'; font-style: normal; font-weight: normal; speak: none; font-variant: normal; text-transform: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: 8px; font-size: 2.4em; height: 40px; overflow: hidden; color: transparent; text-shadow: 0 0 0 var(--green); } .form-label { position: absolute; font-size: 120%; padding-left: var(--space); -webkit-transition: var(--transition); transition: var(--transition); width: calc(100% - 80px); border-radius: 8px; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%); font-weight: 600; z-index: 1; } .form-input:focus { outline: none; } .form-input:focus + .form-label { font-size: 0.875em; color: var(--color-focus); background-color: transparent; top: 20px; } .form-label::before { content: ''; position: absolute; height: 340%; top: -25px; left: 0; right: 0; bottom: 0; background-color: var(--white); z-index: -1; -webkit-transition: var(--transition); transition: var(--transition); } .form-input:focus + .form-label::before { background-color: transparent; opacity: 0; } .form-input-lock { position: absolute; height: 100%; width: 80px; right: 0; } .lock-icon { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%) scale(1); transform: translate(-50%, -50%) scale(1); -webkit-transition: all 0.3s cubic-bezier(0.16, 0.92, 0.31, 1.85); transition: all 0.3s cubic-bezier(0.16, 0.92, 0.31, 1.85); } .lock-icon path { fill: var(--green); opacity: 0.4; } .lock-icon.locked { -webkit-transform: translate(-50%, -50%) scale(1.4); transform: translate(-50%, -50%) scale(1.4); -webkit-transform-origin: center; transform-origin: center; } .lock-icon.locked path { opacity: 1; } @media only screen and (max-height: 320px) { .validation-box { display: -webkit-box; display: flex; flex-wrap: wrap; -webkit-box-align: center; align-items: center; -webkit-box-pack: justify; justify-content: space-between; } .validation-item { width: 40%; } } </style> </head> <body> <div id=&quo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0