💬 Dialog Modal
Диалоговые окна с различными стилями
← Назад к Модальные окна
Классический
HTML
<div class="modal-overlay">
<div class="modal-dialog">
<div class="modal-header">
<h3 class="modal-title">Welcome!</h3>
<button class="modal-close">×</button>
</div>
<div class="modal-body">
<p>Thank you for visiting our website. We're glad to have you here.</p>
</div>
<div class="modal-footer">
<button class="modal-btn-secondary">Cancel</button>
<button class="modal-btn-primary">Continue</button>
</div>
</div>
</div>
CSS
.modal-overlay {
position: relative;
width: 100%;
min-height: 400px;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
border-radius: 8px;
}
.modal-dialog {
background: white;
border-radius: 12px;
width: 400px;
max-width: 100%;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
animation: modalFadeIn 0.3s ease;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.25rem 1.5rem;
border-bottom: 1px solid #e0e0e0;
}
.modal-title {
margin: 0;
font-size: 1.2rem;
font-weight: 700;
color: #1a1a2e;
}
.modal-close {
background: none;
border: none;
font-size: 1.5rem;
color: #999;
cursor: pointer;
padding: 0;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
transition: all 0.2s;
}
.modal-close:hover {
background: #f5f5f5;
color: #1a1a2e;
}
.modal-body {
padding: 1.5rem;
color: #666;
line-height: 1.6;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 0.75rem;
padding: 1rem 1.5rem;
border-top: 1px solid #e0e0e0;
}
.modal-btn-secondary {
padding: 0.6rem 1.25rem;
background: transparent;
color: #666;
border: 1px solid #e0e0e0;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}
.modal-btn-secondary:hover {
background: #f5f5f5;
}
.modal-btn-primary {
padding: 0.6rem 1.25rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.modal-btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
@keyframes modalFadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
С иконкой
HTML
<div class="modal-overlay">
<div class="modal-icon-dialog">
<div class="modal-icon-circle">
<span class="modal-icon-symbol">🎉</span>
</div>
<h3 class="modal-icon-title">Congratulations!</h3>
<p class="modal-icon-text">You've successfully completed the course. Your certificate is ready to download.</p>
<button class="modal-icon-btn">Download Certificate</button>
</div>
</div>
CSS
.modal-overlay {
position: relative;
width: 100%;
min-height: 400px;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
border-radius: 8px;
}
.modal-icon-dialog {
background: white;
border-radius: 16px;
width: 380px;
max-width: 100%;
padding: 2.5rem 2rem;
text-align: center;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
animation: modalFadeIn 0.3s ease;
}
.modal-icon-circle {
width: 80px;
height: 80px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1.5rem;
box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}
.modal-icon-symbol {
font-size: 2.5rem;
}
.modal-icon-title {
margin: 0 0 0.75rem;
font-size: 1.4rem;
font-weight: 700;
color: #1a1a2e;
}
.modal-icon-text {
margin: 0 0 1.5rem;
font-size: 0.95rem;
color: #666;
line-height: 1.6;
}
.modal-icon-btn {
width: 100%;
padding: 0.85rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
font-size: 0.95rem;
}
.modal-icon-btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}
@keyframes modalFadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
Тёмная тема
HTML
<div class="modal-overlay-dark">
<div class="modal-dark">
<div class="modal-dark-header">
<h3 class="modal-dark-title">Settings</h3>
<button class="modal-dark-close">×</button>
</div>
<div class="modal-dark-body">
<p>Customize your preferences and account settings here.</p>
</div>
<div class="modal-dark-footer">
<button class="modal-dark-btn-secondary">Cancel</button>
<button class="modal-dark-btn-primary">Save Changes</button>
</div>
</div>
</div>
CSS
.modal-overlay-dark {
position: relative;
width: 100%;
min-height: 400px;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
border-radius: 8px;
}
.modal-dark {
background: #1a1a2e;
border-radius: 12px;
width: 400px;
max-width: 100%;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
animation: modalFadeIn 0.3s ease;
}
.modal-dark-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.25rem 1.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-dark-title {
margin: 0;
font-size: 1.2rem;
font-weight: 700;
color: white;
}
.modal-dark-close {
background: none;
border: none;
font-size: 1.5rem;
color: #a0a0b0;
cursor: pointer;
padding: 0;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
transition: all 0.2s;
}
.modal-dark-close:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
}
.modal-dark-body {
padding: 1.5rem;
color: #a0a0b0;
line-height: 1.6;
}
.modal-dark-footer {
display: flex;
justify-content: flex-end;
gap: 0.75rem;
padding: 1rem 1.5rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-dark-btn-secondary {
padding: 0.6rem 1.25rem;
background: transparent;
color: #a0a0b0;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 6px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}
.modal-dark-btn-secondary:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
}
.modal-dark-btn-primary {
padding: 0.6rem 1.25rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.modal-dark-btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
@keyframes modalFadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}