Modern Neon Dropdown - 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>Modern Neon Dropdown</title> <style> body { margin: 0; font-family: Arial, sans-serif; background: linear-gradient(to bottom right, #ff9a9e, #fad0c4); display: flex; justify-content: center; align-items: center; height: 100vh; } .dropdown { position: relative; display: inline-block; } .dropdown-button { background: linear-gradient(to right, #ff0081, #ff9a9e); border: none; padding: 12px 24px; width: 250px; font-size: 18px; color: #fff; cursor: pointer; text-shadow: 0 0 5px #ff0081; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); transition: background 0.3s ease, transform 0.3s ease; } .dropdown-button:hover { background: linear-gradient(to right, #ff9a9e, #ff0081); transform: scale(1.1); } .dropdown-content { display: none; position: absolute; background: rgba(0, 0, 0, 0.7); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4); margin-top: 10px; padding: 15px; width: 220px; transition: opacity 0.3s ease, transform 0.3s ease; } .dropdown-content.show { display: block; opacity: 1; transform: translateY(0); } .dropdown-content.hide { opacity: 0; transform: translateY(-10px); } .dropdown-content a { text-decoration: none; color: #fff; display: flex; align-items: center; padding: 12px; transition: background 0.3s ease; } .dropdown-content a:hover { background: rgba(255, 255, 255, 0.2); } .dropdown-content a i { margin-right: 12px; } </style> </head> <body> <div class="dropdown"> <button class="dropdown-button">Neon Dropdown</button> <div class="dropdown-content"> <a href="#"><i class="fa fa-home"></i> Home</a> <a href="#"><i class="fa fa-user"></i> Profile</a> <a href="#"><i class="fa fa-cog"></i> Settings</a> <a href="#"><i class="fa fa-sign-out-alt"></i> Logout</a> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script> <script> document.querySelector('.dropdown-button').addEventListener('click', function() { const dropdownContent = document.querySelector('.dropdown-content'); const isVisible = dropdownContent.classList.contains('show'); if (isVisible) { dropdownContent.classList.remove('show'); dropdownContent.classList.add('hide'); } else { dropdownContent.classList.remove('hide'); dropdownContent.classList.add('show'); dropdownContent.style.animation = 'fadeInUp 0.3s forwards'; } }); window.addEventListener('click', function(event) { if (!event.target.matches('.dropdown-button')) { const dropdowns = document.querySelectorAll('.dropdown-content'); dropdowns.forEach(function(dropdown) { if (dropdown.classList.contains('show')) { dropdown.classList.remove('show'); dropdown.classList.add('hide'); dropdown.style.animation = 'fadeOutDown 0.3s forwards'; } }); } }); </script> </body> </html>