Modern Frosted 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>Modern Frosted Modal</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <style> body { font-family: 'Arial', sans-serif; background: linear-gradient(to bottom right, #b3cdd1, #e5e5e5); margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; } .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); display: none; justify-content: center; align-items: center; } .modal { background: rgba(255, 255, 255, 0.5); border-radius: 25px; box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3); width: 60%; max-width: 550px; padding: 30px; position: relative; animation: fadeIn 0.6s ease; } .modal-header { display: flex; justify-content: space-between; align-items: center; } .modal-title { font-size: 1.7rem; color: #222; } .modal-close { background: none; border: none; font-size: 1.8rem; color: #222; cursor: pointer; transition: color 0.3s ease; } .modal-close:hover { color: #1e90ff; } .modal-body { margin-top: 20px; font-size: 1.2rem; color: #666; } .modal-footer { display: flex; justify-content: flex-end; margin-top: 20px; } .modal-button { background: linear-gradient(to right, #1e90ff, #00bfff); border: none; color: #fff; padding: 14px 25px; border-radius: 8px; font-size: 1.2rem; cursor: pointer; transition: background 0.3s ease, transform 0.3s ease; } .modal-button:hover { background: linear-gradient(to right, #00bfff, #1e90ff); transform: scale(1.1); } @keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } } </style> </head> <body> <button id="openModalBtn" class="modal-button">Open Frosted Modal</button> <div id="modalOverlay" class="modal-overlay"> <div class="modal"> <div class="modal-header"> <h2 class="modal-title">Modern Frosted Modal</h2> <button id="closeModalBtn" class="modal-close"><i class="fas fa-times"></i></button> </div> <div class="modal-body"> <p>Welcome to the Modern Frosted Modal. It features a frosted glass effect with a fresh gradient background and sleek animations for a modern touch.</p> </div> <div class="modal-footer"> <button class="modal-button">Confirm</button> </div> </div> </div> <script> document.getElementById('openModalBtn').addEventListener('click', function() { document.getElementById('modalOverlay').style.display = 'flex'; }); document.getElementById('closeModalBtn').addEventListener('click', function() { document.getElementById('modalOverlay').style.display = 'none'; }); window.addEventListener('click', function(event) { if (event.target === document.getElementById('modalOverlay')) { document.getElementById('modalOverlay').style.display = 'none'; } }); </script> </body> </html>