SOURCE

console 命令行工具 X clear

                    
>
console
<!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, inital-scale=1.0" />
    <!-- <link rel="stylesheet" type="text/css" href="./28.css" /> -->
    <title>CSS</title>
  </head>
  <body>
    <div class="box">
      <h2>密码强度 <span id="text">检测</span></h2>
      <input type="password" id="password" placeholder="请输入密码" />
      <div class="密码强度-"></div>
      <div class="密码强度-"></div>
      <div class="密码强度-"></div>
    </div>
    <script>
      let passwordInput = document.getElementById("password");
      let passwordStrengths = document.querySelectorAll(".密码强度-");
      let text = document.getElementById("text");

      passwordInput.addEventListener("input", function (event) {
        let password = event.target.value;
        let strength = Math.min(password.length, 12);
        let degree = strength * 30;
        let gradienColor =
          strength <= 4 ? "#ff2c1c" : strength <= 8 ? "#ff9800" : "#12ff12";
        let strengthText = strength <= 4 ? "弱" : strength <= 8 ? "中" : "强";

        passwordStrengths.forEach((passwordStrengths) => {
          passwordStrengths.style.background = `conic-gradient(${gradienColor} ${degree}deg, #1115 ${degree}deg)`;
        });

        text.textContent = strengthText;
        text.style.color = gradienColor;
      });
    </script>
  </body>
</html>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: consolas;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #333;
}
.box {
  position: relative;
  width: 300px;
  height: 50px;
}
.box h2 {
  position: absolute;
  top: -40px;
  font-size: 1.25em;
  color: #fff;
  font-weight: 500;
}
.box input {
  position: absolute;
  inset: 2px;
  z-index: 10;
  font-size: 1em;
  border: none;
  outline: none;
  padding: 10px 15px;
  background: #333;
  color: #fff;
}
.box .密码强度- {
  position: absolute;
  inset: 0;
  background: #1115;
}
.box .密码强度-:nth-child(3) {
  filter: blur(5px);
}
.box .密码强度-:nth-child(4) {
  filter: blur(10px);
}