Sticky 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>Sticky Alert</title> <style> body { font-family: 'Montserrat', Arial, sans-serif; margin: 0; padding: 0; height: 2000px; /* Just for demonstration */ background: linear-gradient(120deg, #f6d365 0%, #fda085 100%); } .sticky-container { position: -webkit-sticky; position: sticky; top: 35px; margin: 70px; padding: 50px; background: #fff; border-radius: 20px; box-shadow: 0 12px 36px rgba(0,0,0,0.3); transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; } .sticky-container:hover { transform: translateY(-15px); box-shadow: 0 16px 48px rgba(0,0,0,0.4); } .sticky-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 20px; border-bottom: 2px solid #eee; margin-bottom: 25px; } .sticky-header h2 { margin: 0; font-size: 2em; color: #f6d365; } .sticky-header .icon { font-size: 2em; } .sticky-content { display: flex; flex-direction: column; align-items: center; text-align: center; } .sticky-content p { margin: 15px 0; font-size: 1.4em; line-height: 1.8; } .sticky-footer { margin-top: 30px; display: flex; justify-content: space-around; } .sticky-footer button { padding: 14px 30px; border: none; border-radius: 12px; background: #fda085; color: #fff; font-size: 1.2em; cursor: pointer; transition: background 0.3s ease; } .sticky-footer button:hover { background: #f6b973; } /* Animations */ @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } } .sticky-container:hover .icon { animation: bounce 1s infinite; } .sticky-content p { animation: fadeIn 0.5s ease-in-out; } @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } </style> </head> <body> <div class="sticky-container"> <div class="sticky-header"> <h2>Alert <span class="icon">â ī¸</span></h2> </div> <div class="sticky-content"> <p>There is a scheduled maintenance tonight.</p> <p>Please plan accordingly.</p> </div> <div class="sticky-footer"> <button onclick="action('acknowledge')">đ Acknowledge</button> <button onclick="action('details')">âšī¸ Details</button> </div> </div> <script> function action(type) { alert(`You clicked ${type}!`); } </script> </body> </html>