Retro Pixel 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>Retro Pixel Modal</title> <style> body { font-family: 'Press Start 2P', cursive; background: #222; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; color: #0f0; } .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); justify-content: center; align-items: center; animation: fadeIn 0.5s; } .modal-content { background: #000; border: 4px solid #0f0; border-radius: 10px; width: 400px; padding: 20px; text-align: center; position: relative; box-shadow: 0 0 20px #0f0; animation: glitch 1s infinite; } .modal-content h2 { font-size: 1.5em; margin: 0; color: #0f0; } .modal-content p { font-size: 1em; 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: #000; border: 4px solid #0f0; color: #0f0; padding: 15px 30px; border-radius: 10px; font-size: 1em; cursor: pointer; display: flex; align-items: center; box-shadow: 0 0 20px #0f0; } .open-modal-btn i { margin-right: 10px; font-size: 1.5em; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes glitch { 0% { transform: translate(0); } 20% { transform: translate(-2px, 2px); } 40% { transform: translate(2px, -2px); } 60% { transform: translate(-2px, -2px); } 80% { transform: translate(2px, 2px); } 100% { transform: translate(0); } } </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>Retro Pixel Modal</h2> <p>This is a retro pixel styled modal with glitch effect animations.</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>