Stylish Search Bar - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Stylish Search Bar</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(to right, #4facfe, #00f2fe); font-family: 'Arial', sans-serif; } .search-container { position: relative; width: 400px; max-width: 80%; } .search-bar { width: 100%; padding: 15px; border: 2px solid #fff; border-radius: 50px; background: rgba(255, 255, 255, 0.8); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; font-size: 18px; color: #333; } .search-bar:focus { outline: none; border-color: #4facfe; background: rgba(255, 255, 255, 1); box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); } .search-bar::placeholder { color: #aaa; font-size: 16px; } .search-icon { position: absolute; top: 50%; left: 15px; transform: translateY(-50%); font-size: 24px; color: #333; transition: all 0.3s ease; } .search-bar:focus + .search-icon { color: #4facfe; } .search-button { position: absolute; top: 50%; right: -25px; transform: translateY(-50%); background: #4facfe; border: none; border-radius: 50%; padding: 10px; cursor: pointer; transition: all 0.3s ease; } .search-button:hover { background: #00f2fe; } .search-button:active { transform: translateY(-50%) scale(0.95); } .search-button .icon { font-size: 18px; color: #fff; } @keyframes searchBounce { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -60%) scale(1.2); } } </style> </head> <body> <div class="search-container"> <input type="text" class="search-bar" placeholder="Search here..."> <button class="search-button"> <i class="icon">Go</i> </button> </div> <script> document.querySelector('.search-bar').addEventListener('focus', function() { document.querySelector('.search-container:after').style.animationPlayState = 'paused'; }); document.querySelector('.search-bar').addEventListener('blur', function() { document.querySelector('.search-container:after').style.animationPlayState = 'running'; }); </script> </body> </html>