Сделать lightbox на всю высоту экрана с небольшими отступами

Панель занимает 100dvh минус 1rem сверху/снизу; QR растягивается
в оставшееся пространство.
This commit is contained in:
Sergey Antropoff
2026-07-23 09:16:45 +03:00
parent ed6aa93eb3
commit 805e225087
2 changed files with 46 additions and 18 deletions
@@ -251,7 +251,7 @@
display: flex;
align-items: center;
justify-content: center;
padding: 1.75rem 1rem;
padding: 1rem;
box-sizing: border-box;
background: rgba(8, 12, 18, 0.72);
backdrop-filter: blur(10px);
@@ -268,16 +268,19 @@
}
.lightbox-panel {
position: relative;
max-width: min(94vw, 832px);
max-height: calc(100dvh - 3.5rem);
width: 100%;
display: flex;
flex-direction: column;
width: min(94vw, 900px);
height: calc(100dvh - 2rem);
max-height: calc(100dvh - 2rem);
padding: 1.25rem 1.25rem 1rem;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 18px;
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
text-align: center;
overflow: auto;
overflow: hidden;
box-sizing: border-box;
transform: translateY(12px) scale(0.96);
transition: transform 0.22s ease;
}
@@ -286,11 +289,10 @@
}
.lightbox-panel img {
display: block;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
max-width: min(728px, 100%);
max-height: min(728px, calc(100dvh - 14rem));
margin: 0 auto;
aspect-ratio: 1;
object-fit: contain;
background: #fff;
@@ -299,18 +301,28 @@
box-sizing: border-box;
image-rendering: pixelated;
}
.lightbox-media {
flex: 1 1 auto;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
}
.lightbox-caption {
flex-shrink: 0;
margin-top: 0.85rem;
font-size: 0.95rem;
font-weight: 650;
color: var(--text);
}
.lightbox-hint {
flex-shrink: 0;
margin-top: 0.25rem;
font-size: 0.75rem;
color: var(--muted);
}
.lightbox-actions {
flex-shrink: 0;
margin-top: 1rem;
display: flex;
justify-content: center;
@@ -499,7 +511,9 @@
<div class="lightbox" id="lightbox" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="lightbox-caption">
<div class="lightbox-panel" role="document">
<button type="button" class="lightbox-close" id="lightbox-close" aria-label="Закрыть">&times;</button>
<img id="lightbox-img" src="" alt="">
<div class="lightbox-media">
<img id="lightbox-img" src="" alt="">
</div>
<p class="lightbox-caption" id="lightbox-caption"></p>
<div class="lightbox-actions">
<a class="lightbox-download" id="lightbox-download" href="#" download>