Highly Styled Modal - 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>Highly Styled Modal</title> <style> body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #f06, #4a90e2); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); justify-content: center; align-items: center; animation: fadeIn 0.5s; } .modal-content { background: white; border-radius: 20px; width: 500px; padding: 20px; text-align: center; position: relative; transform: scale(0); animation: zoomIn 0.5s forwards; } .modal-content h2 { font-size: 2em; margin: 0; color: #333; } .modal-content p { font-size: 1.2em; color: #666; margin: 20px 0; } .modal-content .close-btn { position: absolute; top: 20px; right: 20px; background: transparent; border: none; font-size: 1.5em; cursor: pointer; color: #333; } .open-modal-btn { background: #4a90e2; border: none; color: white; padding: 15px 30px; border-radius: 30px; font-size: 1.2em; cursor: pointer; animation: bounce 2s infinite; display: flex; align-items: center; } .open-modal-btn i { margin-right: 10px; font-size: 1.5em; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes zoomIn { from { transform: scale(0); } to { transform: scale(1); } } @keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-30px); } 60% { transform: translateY(-15px); } } </style> </head> <body> <button class="open-modal-btn"><i>💬</i> Open Modal</button> <div class="modal" id="myModal"> <div class="modal-content"> <button class="close-btn" id="closeBtn">✖️</button> <h2>Modal Title</h2> <p>This is a highly styled modal with animations, emojis, and icons.</p> </div> </div> <script> const modal = document.getElementById('myModal'); const openModalBtn = document.querySelector('.open-modal-btn'); const closeBtn = document.getElementById('closeBtn'); openModalBtn.addEventListener('click', () => { modal.style.display = 'flex'; }); closeBtn.addEventListener('click', () => { modal.style.display = 'none'; }); window.addEventListener('click', (event) => { if (event.target === modal) { modal.style.display = 'none'; } }); </script> </body> </html>