输入框浮动标签特效
代码语言:html
所属分类:表单美化
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Form Fields | CSS Only Floating Label</title> <link rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/reset.min.css"> <style> html { height: 100%; } body { height: 100%; display: flex; align-items: center; background-color: #edf2f7; padding: 0 30%; } .login-form { width: 360px; padding: 0; margin: auto; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); background: white; border-radius: 8px; padding: 0; overflow: hidden; } .login-form .login-form--head { padding: 0; margin: 0; } .login-form .login-form--head img { border-radius: 8px 8px 0 0; } .login-form form { padding: 1.5rem 1.5rem 1rem; font-weight: 400; overflow: hidden; background: #fff; margin-top: 0; box-shadow: none; } .login-form .login-form--field { margin: 0 0 1rem; position: relative; } .login-form .login-form--field label { position: absolute; left: 12px; z-index: 10; display: block; cursor: default; line-height: 1; z-index: 0; color: #4a5568; transition: all 0.25s ease-out; font-size: 8px; top: 10px; transform: translateY(0%); } .login-form .login-form--field input { margin: 0; box-sizing: border-box; font-weight: 300; font-size: 16px; display: block; padding: 18px 12px 0 !important; height: 50px; width: 100%; outline: 0; position: relative; z-index: 1; background: none; border-radius: 4px; border: 1px solid #f1f1f1; box-shadow: 0 1px 0 0 rgba(230, 230, 230, 0.5); transition: box-shadow 0.15s ease-out; } .login-form .login-form--field input::placeholder { opacity: 0; } .login-form .login-form--field input:placeholder-shown + label { font-size: 14px; transition: all 0.25s ease-out; top: 50%; transform: translateY(-50%); } .login-form .login-form--field input:focus + label { transition: all 0.25s ease-out; font-size: 8px; top: 10px; transform: none; } .login-form .login-form--button { line-heig.........完整代码请登录后点击上方下载按钮下载查看
网友评论0