Fantasy Forest 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>Fantasy Forest Modal</title> <style> body { font-family: 'Arial', sans-serif; background: url('https://source.unsplash.com/1600x900/?forest') no-repeat center center/cover; 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: rgba(0, 0, 0, 0.9); border-radius: 20px; width: 450px; padding: 20px; text-align: center; position: relative; box-shadow: 0 0 20px #0f0; animation: shimmer 1s infinite; } .modal-content h2 { font-size: 2em; margin: 0; color: #0f0; } .modal-content p { font-size: 1.2em; color: #0f0; margin: 20px 0; } .modal-content .close-btn { position: absolute; top: 20px; right: 20px; background: transparent; border: none; font-size: 1.5em; cursor: pointer; color: #0f0; } .open-modal-btn { background: #0f0; border: none; color: #000; padding: 15px 30px; border-radius: 30px; font-size: 1.2em; cursor: pointer; display: flex; align-items: center; box-shadow: 0 0 10px #0f0; animation: glow 2s infinite; } .open-modal-btn i { margin-right: 10px; font-size: 1.5em; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes shimmer { 0% { box-shadow: 0 0 10px #0f0; } 50% { box-shadow: 0 0 20px #0f0; } 100% { box-shadow: 0 0 10px #0f0; } } @keyframes glow { 0% { box-shadow: 0 0 10px #0f0; } 50% { box-shadow: 0 0 20px #0f0; } 100% { box-shadow: 0 0 10px #0f0; } } </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>Fantasy Forest Modal</h2> <p>This is a fantasy forest themed modal with a shimmering animation.</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>