Skip to content

Commit

Permalink
images: center lightbox on both axes when shown
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Zeuch <l-zeuch@email.de>
  • Loading branch information
l-zeuch committed Jan 12, 2025
1 parent d4f8e35 commit a6e38ef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions assets/scss/components/_images.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,29 @@ figcaption {

/* CSS-only lightbox. See https://codesalad.dev/blog/how-to-create-an-image-lightbox-in-pure-css-25 */
.lightbox {
/* Default to hidden */
display: none;

/* Overlay entire screen */
position: fixed;
z-index: 99999;
top: 0;
left: 0;
right: 0;
bottom: 0;

/* A bit of padding around image */
padding: 1em;

/* Translucent background */
background: rgba(0, 0, 0, 1);
background: rgba(0, 0, 0, 0.85);

/* center that thang, ya get me? */
justify-content: center;
align-items: center;
text-align: center;
white-space: nowrap;
}

/* Unhide the lightbox when it's the target */
.lightbox:target {
display: block;
display: flex;
}

.lightbox span {
Expand Down

0 comments on commit a6e38ef

Please sign in to comment.