Glassmorphism 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>Glassmorphism Search Bar</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background: #000; font-family: 'Arial', sans-serif; } .search-container { position: relative; width: 400px; } .search-input { width: 100%; padding: 15px 20px; border: none; border-radius: 15px; background: rgba(255, 255, 255, 0.2); color: #fff; font-size: 18px; outline: none; } .search-icon { position: absolute; top: 50%; right: 20px; transform: translateY(-50%); font-size: 24px; color: #fff; cursor: pointer; } </style> </head> <body> <div class="search-container"> <input type="text" class="search-input" placeholder="Glass Search..."> </div> <script> document.querySelector('.search-icon').addEventListener('click', () => { alert(`Searching for: ${document.querySelector('.search-input').value}`); }); document.querySelector('.search-input').addEventListener('keypress', (e) => { if (e.key === 'Enter') { alert(`Searching for: ${document.querySelector('.search-input').value}`); } }); </script> </body> </html>