Ocean Wave Select Box - 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>Ocean Wave Select Box</title> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet"> <style> body { font-family: 'Poppins', sans-serif; background: linear-gradient(to right, #00c6ff, #0072ff); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .select-box { position: relative; width: 280px; margin: 50px; } .select-box select { display: none; /* Hide default select */ } .select-box .custom-select { background-color: #ffffff; border-radius: 25px; border: 1px solid #ddd; padding: 10px 20px; font-size: 16px; color: #0072ff; cursor: pointer; position: relative; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; } .select-box .custom-select:hover { box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15); } .select-box .custom-select::after { content: '🌊'; font-size: 18px; margin-left: 10px; } .select-box .select-options { position: absolute; top: 100%; left: 0; right: 0; margin-left: 0; padding-left: 0; background-color: #ffffff; border-radius: 25px; border: 1px solid #ddd; margin-top: 2px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); z-index: 10; opacity: 0; visibility: hidden; transform: translateY(-20px); transition: all 0.3s ease; } .select-box.active .select-options { opacity: 1; visibility: visible; transform: translateY(0); } .select-box .select-options li { list-style: none; padding: 10px 20px; font-size: 16px; color: #0072ff; cursor: pointer; transition: all 0.3s ease; } .select-box .select-options li:hover { background-color: #e2f3ff; border-radius: 25px; } .select-box .select-options li.selected { background-color: #d1e9ff; } </style> </head> <body> <div class="select-box"> <div class="custom-select">Choose an option</div> <ul class="select-options"> <li data-value="1">Surfing <span class="emoji">🏄♂️</span></li> <li data-value="2">Diving <span class="emoji">🤿</span></li> <li data-value="3">Swimming <span class="emoji">🏊♀️</span></li> </ul> <select> <option value="1">Surfing</option> <option value="2">Diving</option> <option value="3">Swimming</option> </select> </div> <script> document.addEventListener('DOMContentLoaded', function() { const selectBox = document.querySelector('.select-box'); const customSelect = selectBox.querySelector('.custom-select'); const selectOptions = selectBox.querySelector('.select-options'); const options = selectOptions.querySelectorAll('li'); const select = selectBox.querySelector('select'); customSelect.addEventListener('click', function() { selectBox.classList.toggle('active'); }); options.forEach(option => { option.addEventListener('click', function() { const value = option.getAttribute('data-value'); const text = option.textContent; customSelect.innerHTML = text + ' <span class="emoji">' + option.querySelector('.emoji').textContent + '</span>'; selectBox.classList.remove('active'); options.forEach(opt => opt.classList.remove('selected')); option.classList.add('selected'); select.value = value; }); }); document.addEventListener('click', function(e) { if (!selectBox.contains(e.target)) { selectBox.classList.remove('active'); } }); }); </script> </body> </html>