blankify

You use this AI prompt bar daily but never knew how it's built #coding #webdesign #ai #css #frontend

Source Code

index.html
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>AI Prompt Bar</title>
  <link rel="stylesheet" href="styles.css"/>
</head>
<body>
  <main class="container">
    <h1 class="title">What can I help with?</h1>
    <div class="prompt-bar">
      <div class="glow-border"></div>
      <div class="inner">
        <span class="sparkle">✦</span>
        <input class="placeholder" placeholder="Ask AI anything…"/>
        <button class="ask-btn">Ask AI ✦</button>
      </div>
    </div>
  </main>
</body>
</html>
styles.css
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  box-sizing: border-box;
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse at 25% 35%, rgba(124, 58, 237, .2), transparent 55%),
    radial-gradient(ellipse at 75% 65%, rgba(56, 189, 248, .13), transparent 55%),
    #08080c;
  color: #f4f4f5;
}

.container {
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 22px;
  padding: 32px;
}

.title {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(to right, #f1f5f9, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.prompt-bar {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: 2px;
  border-radius: 20px;
  overflow: hidden;

  .glow-border {
    position: absolute;
    inset: -80%;
    background: conic-gradient(
      from 0deg,
      rgba(124, 58, 237, .5) 0%,
      rgba(124, 58, 237, .5) 40%,
      #7c3aed 55%,
      #38bdf8 65%,
      #f472b6 75%,
      rgba(124, 58, 237, .5) 90%,
      rgba(124, 58, 237, .5) 100%
    );
    animation: spin 3.5s linear infinite;
  }
}

.inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(10, 10, 16, .9);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, .03);

  .sparkle {
    font-size: 24px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #a78bfa, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, .7));
  }

  .placeholder {
    flex: 1;
    font-size: 15px;
    color: #f4f4f5;
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
  }

  .placeholder::placeholder {
    color: rgba(255, 255, 255, .3);
  }
}

.ask-btn {
  padding: 11px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #6366f1, #38bdf8);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow:
    0 0 24px rgba(124, 58, 237, .4),
    0 0 64px rgba(99, 102, 241, .12);
}

@media only screen and (max-width: 480px) {
  .inner {
    flex-wrap: wrap;
  }

  .inner .placeholder {
    min-width: 0;
  }

  .ask-btn {
    flex: 1 1 100%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}