Home >Web Front-end >JS Tutorial >OTP UI/UX with html css and javascript

OTP UI/UX with html css and javascript

Patricia Arquette
Patricia ArquetteOriginal
2024-12-31 07:41:09177browse

OTP UI/UX with html css and javascript

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Interactive OTP Input</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      background-color: #1e1e2e;
      margin: 0;
    }

    .container {
      text-align: center;
      background: #2a2a40;
      padding: 30px;
      border-radius: 8px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }

    h2 {
      color: #c792ea;
      margin-bottom: 20px;
    }

    .otp-input {
      display: flex;
      justify-content: center;
      gap: 10px;
    }

    .otp-input input {
      width: 50px;
      height: 50px;
      text-align: center;
      font-size: 1.5em;
      border: 2px solid #444;
      border-radius: 5px;
      outline: none;
      transition: all 0.3s ease;
      color: #fff;
      background: #1e1e2e;
    }

    .otp-input input:focus {
      border-color: #c792ea;
      box-shadow: 0 0 10px #c792ea;
    }

    .otp-input input.correct {
      border-color: #4caf50;
      box-shadow: 0 0 10px #4caf50;
    }

    .otp-input input.error {
      border-color: #ff4c4c;
      box-shadow: 0 0 10px #ff4c4c;
      animation: shake 0.3s ease-in-out;
    }

    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-5px); }
      50% { transform: translateX(5px); }
      75% { transform: translateX(-5px); }
    }

    .message {
      margin-top: 15px;
      font-size: 1em;
      color: #fff;
    }

    .message.success {
      color: #4caf50;
    }

    .message.error {
      color: #ff4c4c;
    }
  </style>
</head>
<body>
  <div>




          

            
        

The above is the detailed content of OTP UI/UX with html css and javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn