Sticky 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>Sticky Notification</title> <style> body { font-family: 'Courier New', Courier, monospace; margin: 0; padding: 0; height: 2000px; /* Just for demonstration */ background: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%); } .sticky-container { position: -webkit-sticky; position: sticky; top: 20px; margin: 40px; padding: 30px; background: #fff; border-radius: 15px; box-shadow: 0 6px 18px rgba(0,0,0,0.3); transition: transform 0.3s ease-in-out, background 0.3s ease-in-out; } .sticky-container:hover { transform: scale(1.05); background: #f0f0f0; } .sticky-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 15px; border-bottom: 2px solid #ccc; margin-bottom: 20px; } .sticky-header h2 { margin: 0; font-size: 1.7em; color: #8ec5fc; } .sticky-header .icon { font-size: 1.7em; } .sticky-content { display: flex; flex-direction: column; align-items: center; text-align: center; } .sticky-content p { margin: 15px 0; font-size: 1.2em; line-height: 1.6; } .sticky-footer { margin-top: 25px; display: flex; justify-content: space-around; } .sticky-footer button { padding: 12px 25px; border: none; border-radius: 10px; background: #8ec5fc; color: #fff; font-size: 1.1em; cursor: pointer; transition: background 0.3s ease; } .sticky-footer button:hover { background: #7bb0f7; } /* Animations */ @keyframes grow { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } } .sticky-container:hover .icon { animation: grow 1s infinite; } .sticky-content p { animation: slideIn 0.5s ease-in-out; } @keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } </style> </head> <body> <div class="sticky-container"> <div class="sticky-header"> <h2>Notification <span class="icon">🔔</span></h2> </div> <div class="sticky-content"> <p>You have a new message.</p> <p>Check your inbox for more details.</p> </div> <div class="sticky-footer"> <button onclick="action('view')">📩 View</button> <button onclick="action('dismiss')">🚫 Dismiss</button> </div> </div> <script> function action(type) { alert(`You clicked ${type}!`); } </script> </body> </html>