From 82ccc2c4d90535459bc2b6c478d638064ee68b34 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Wed, 6 Jan 2021 10:23:45 +0100 Subject: [PATCH] Preserve aspect ratio, use correct figure caption --- static/css/lightbox.css | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/static/css/lightbox.css b/static/css/lightbox.css index 3166a75..a237b4b 100644 --- a/static/css/lightbox.css +++ b/static/css/lightbox.css @@ -8,8 +8,10 @@ z-index: 999; width: 100vw; height: 100vh; - background: rgba(0, 0, 0, 0.8); } - .lightbox img { + background: rgba(0, 0, 0, 0.8); +} + +.lightbox img { position: absolute; top: 0; left: 0; @@ -17,7 +19,10 @@ bottom: 0; margin: auto; max-width: 100%; - max-height: 100%; } - .lightbox:target { + max-height: 100%; + object-fit: contain; +} + +.lightbox:target { outline: none; display: block; }