js+css实现数字验证码分体式输入框代码

代码语言:html

所属分类:表单美化

代码描述:js+css实现数字验证码分体式输入框代码

代码标签: js css 数字 验证码 分体式 输入框 代码

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

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

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>验证码输入框</title>

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

  .container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
  }

  .wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 240px;
  }

  .title {
    color: #009933;
    font-size: 32px;
    margin-bottom: 10px;
  }

  .wrap-inp {
    position: relative;
    width: 100%;
    height: 40px;
  }

  .inp {
    position: absolute;
    width: 100%;
    height: 40px;
    border: none;
    outline: none;
    /* 提高层级,让透明也被选中 */
    background-color: #ffd04d;
    opacity: 0;
  }

  .items {
    display: flex;
  }

  .item {
    width: 30px;
    height: 40px;
    background-color: #2c313c;
    border-radius: 4px;
    margin: 0 5px;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .active {
    position: relative;
    border: 1px solid #666;
    transition: .5s;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .active::after {
    content: '';
    position: absolute;
    border-radius: 1px;
    width: 1px;
    height: 60%;
    background-color: #666;
    animation: zoom 1.5s linear infinite;
  }

  @keyframes zoom {
    0% {
      transform: scaleY(1);
    }

    50% {
      transform: scaleY(0);
    }

    100% {
      transform: scaleY(1);
    }
  }
</style>
</head>
<body>
  <div class="container">
    <div class="wrap">
      <div class="title">请输入验证码</div>
      <div class="wrap-inp">
        <input class="inp" type="text" />
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0