Highly Styled 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>Highly Styled Alert</title> <style> body { font-family: 'Arial', sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(135deg, #f5f7fa, #c3cfe2); margin: 0; } .alert-wrapper { position: relative; display: inline-block; } .alert-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); padding: 35px; background: #fff; border-radius: 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); text-align: center; animation: scaleIn 0.5s forwards, slideIn 0.5s ease-in-out; transition: all 0.3s ease; } .alert-box.show { transform: translate(-50%, -50%) scale(1); } .alert-box h1 { font-size: 24px; margin: 0 0 10px; } .alert-box p { font-size: 16px; margin: 0 0 20px; } .alert-box .alert-icon { font-size: 50px; margin-bottom: 10px; } .alert-box .alert-emoji { font-size: 30px; margin-bottom: 20px; } .alert-box .alert-buttons { display: flex; justify-content: center; } .alert-box .alert-buttons button { border: none; padding: 10px 20px; margin: 0 5px; border-radius: 5px; cursor: pointer; transition: background 0.3s ease, transform 0.3s ease; } .alert-box .alert-buttons .confirm { background: #28a745; color: #fff; } .alert-box .alert-buttons .cancel { background: #dc3545; color: #fff; } .alert-box .alert-buttons button:hover { transform: scale(1.05); } @keyframes scaleIn { 0% { transform: translate(-50%, -50%) scale(0); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } } @keyframes slideIn { 0% { transform: translate(-50%, -150%); opacity: 0; } 100% { transform: translate(-50%, -50%); opacity: 1; } } </style> </head> <body> <div class="alert-wrapper"> <div class="alert-box" id="alert-box"> <div class="alert-icon">⚠️</div> <h1>Attention!</h1> <p>This is a highly styled alert box with animations, emojis, and icons.</p> <div class="alert-emoji">🚀</div> <div class="alert-buttons"> <button type="button" class="confirm">Confirm</button> <button type="button" class="cancel">Cancel</button> </div> </div> </div> <script> function showAlert() { document.querySelector('.alert-box').classList.add('show'); } document.addEventListener('DOMContentLoaded', () => { showAlert(); document.querySelector('.confirm').addEventListener('click', () => { alert('Confirmed!'); }); document.querySelector('.cancel').addEventListener('click', () => { document.getElementById("alert-box").style.display="none"; }); }); </script> </body> </html>