پیشنمایش زنده
کد HTML
<div class="modern-success-message">
<button class="close-btn">×</button>
<div class="icon-wrapper">
<svg
stroke-linejoin="round"
stroke-linecap="round"
stroke-width="2"
stroke="currentColor"
fill="none"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
class="success-icon"
>
<path d="M9 12l2 2 4-4"></path>
<circle r="10" cy="12" cx="12"></circle>
</svg>
</div>
<div class="text-wrapper">
<div class="title">Success</div>
<div class="message">Operation completed successfully</div>
</div>
</div>
کد CSS
.modern-success-message {
display: flex;
align-items: center;
padding: 10px 15px;
background: linear-gradient(135deg, #00c6ff, #0072ff);
border-radius: 10px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
color: white;
font-family: "Poppins", sans-serif;
position: relative;
overflow: hidden;
transition:
transform 0.3s ease-in-out,
box-shadow 0.3s ease-in-out;
}
.modern-success-message:hover {
transform: scale(1.05);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}
.close-btn {
position: absolute;
top: 12px;
right: 20px;
background: none;
border: none;
font-size: 30px;
color: white;
cursor: pointer;
opacity: 0.8;
transition: opacity 0.3s;
}
.close-btn:hover {
opacity: 1;
}
.icon-wrapper {
background-color: rgba(255, 255, 255, 0.15);
padding: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.success-icon {
width: 40px;
height: 40px;
}
.text-wrapper .title {
font-size: 18px;
font-weight: 700;
letter-spacing: 1.2px;
text-transform: uppercase;
}
.text-wrapper .message {
margin-top: 6px;
font-size: 14px;
opacity: 0.85;
}
.modern-success-message::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(
circle,
rgba(255, 255, 255, 0.1),
rgba(255, 255, 255, 0)
);
transform: rotate(45deg);
transition: all 0.5s ease-in-out;
}
.modern-success-message:hover::before {
transform: rotate(90deg);
opacity: 0.5;
}