Dark Mode Alert - 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>Dark Mode Alert</title> <style> body { font-family: Arial, sans-serif; background-color: #212121; color: #ffffff; display: flex; justify-content: center; align-items: center; height: 100vh; } .alert-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 9999; opacity: 0; visibility: hidden; transition: opacity 0.5s, visibility 0.5s; } .alert { background-color: #333333; border-radius: 15px; padding: 25px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.7); text-align: center; animation: fadeIn 0.5s ease-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .alert-header { display: flex; justify-content: center; align-items: center; font-size: 26px; font-weight: bold; margin-bottom: 15px; } .alert-header .icon { margin-right: 10px; } .alert-body { font-size: 20px; margin-bottom: 20px; } .alert-footer { display: flex; justify-content: center; } .alert-footer button { background-color: #00e676; color: #212121; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: background-color 0.3s; } .alert-footer button:hover { background-color: #00c853; } .show-alert { opacity: 1; visibility: visible; } .show-alert2 { width: auto; height: 50px; background: #00e676; border: none; outline: none; color: #fff; border-radius: 5px; padding-left: 3%; padding-right: 3%; opacity: 1; visibility: visible; cursor: pointer; font-size: 1.2em; } </style> </head> <body> <div class="alert-container" id="alertContainer"> <div class="alert"> <div class="alert-header"> <span class="icon">🌙</span> <span>Dark Mode Alert</span> </div> <div class="alert-body"> This is a dark mode alert with fade-in animation. </div> <div class="alert-footer"> <button type="button" onclick="closeAlert()">Close</button> </div> </div> </div> <button type="button" onclick="showAlert()" class="show-alert2">Show Dark Mode Alert</button> <script> function showAlert() { document.getElementById('alertContainer').classList.add('show-alert'); } function closeAlert() { document.getElementById('alertContainer').classList.remove('show-alert'); } </script> </body> </html>