Modern alert and notification components with various styles, animations, and interactive features. Perfect for user feedback, warnings, errors, and informational messages.
.alert {
padding: 1rem 1.25rem;
border-radius: 8px;
display: flex;
align-items: flex-start;
gap: 1rem;
animation: alert-entrance 0.3s ease-out;
}
.alert-success {
background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
color: #1e4620;
border-left: 4px solid #43e97b;
}
@keyframes alert-entrance {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
Click the × to dismiss
/* Checkbox hack for dismissible alerts */
.alert-close {
position: absolute;
opacity: 0;
cursor: pointer;
}
.alert-close-label {
position: absolute;
top: 1rem;
right: 1rem;
cursor: pointer;
}
.alert-close:checked + .alert {
animation: alert-exit 0.3s ease-out forwards;
}
@keyframes alert-exit {
to {
opacity: 0;
transform: translateX(100%);
max-height: 0;
padding: 0;
margin: 0;
}
}
.toast {
position: fixed;
top: 2rem;
right: 2rem;
min-width: 300px;
max-width: 400px;
box-shadow: 0 8px 24px rgba(0,0,0,0.2);
animation: toast-entrance 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes toast-entrance {
from {
opacity: 0;
transform: translateX(100%);
}
to {
opacity: 1;
transform: translateX(0);
}
}
This is some text with an inline warning embedded within it.
.alert-actions {
display: flex;
gap: 0.5rem;
margin-top: 0.75rem;
}
.alert-button {
padding: 0.4rem 1rem;
border: none;
border-radius: 4px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s ease;
}
.alert-button:hover {
transform: translateY(-1px);
}
.alert-loading::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: 3px;
width: 100%;
background: linear-gradient(90deg, transparent, rgba(0,0,0,0.2), transparent);
animation: loading-bar 1.5s ease-in-out infinite;
}