js实现表单input focus跟随动画效果代码

代码语言:html

所属分类:表单美化

代码描述:js实现表单input focus跟随动画效果代码

代码标签: input focus 跟随 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">


  
  
<style>
* { box-sizing: border-box; }

html, body {
  font-size: 20px;
  height: 100vh;
  margin: 0;
  background-color: #fff;
}

.form-wrapper {
  position: relative;
  display: grid;
  height: 100%;
  margin: 0;
  place-items: center;
  max-width: 100%;
  padding: 2rem;
}

form {
  margin: auto;
  width: 100%;
  max-width: 400px;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: #444;
}

input {
  display: block;
  width: 100%;
  margin: 0 0 1rem 0;
  padding: 0.5rem;
  font-size: 1rem;
  border: 0;
  border-radius: 0.125rem 0.25rem;
  background-color: hsl(222, 20%, 95%);
}

button {
  display: block;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.125rem 0.25rem;
  background-color: #40cb90;
  color: #fff;
  margin: 2rem 0 0 auto;
}

input:focus,
button:focus{
  outline: 0;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
</style>




</head>

<body>
  <canvas></canvas>

<div class="form-wrapper">
  <form onsubmit="return false;"  autocomplete="off">
    <label for="name">Name</label>
    <input type="text&qu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0