Soft Pastel Toast Notification - 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>Soft Pastel Toast Notification</title> <style> body { font-family: Arial, sans-serif; background: linear-gradient(135deg, #d7e1ec 0%, #f9d6d6 100%); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; overflow: hidden; } .toast-container { position: fixed; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 10px; } .toast { display: flex; align-items: center; padding: 15px; min-width: 300px; background: linear-gradient(135deg, #ffffff 0%, #f2f2f2 100%); border-radius: 15px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); animation: slideInLeft 0.5s, fadeOut 0.5s 3s; } .toast-icon { font-size: 24px; margin-right: 15px; color: #ff7f7f; } .toast-content { flex-grow: 1; } .toast-content h4 { margin: 0; font-size: 18px; color: #333; } .toast-content p { margin: 5px 0 0; color: #666; } @keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } </style> </head> <body> <div class="toast-container" id="toast-container"></div> <script> function showToast(title, message, icon) { const toastContainer = document.getElementById('toast-container'); const toast = document.createElement('div'); toast.className = 'toast'; const toastIcon = document.createElement('div'); toastIcon.className = 'toast-icon'; toastIcon.innerHTML = icon; const toastContent = document.createElement('div'); toastContent.className = 'toast-content'; const toastTitle = document.createElement('h4'); toastTitle.innerText = title; const toastMessage = document.createElement('p'); toastMessage.innerText = message; toastContent.appendChild(toastTitle); toastContent.appendChild(toastMessage); toast.appendChild(toastIcon); toast.appendChild(toastContent); toastContainer.appendChild(toast); setTimeout(() => { toast.remove(); }, 4000); } // Example usage showToast('Alert', 'This is an important alert.', '⚡'); showToast('Notice', 'Please review the latest changes.', '📋'); </script> </body> </html>