From fa1a7b35ad47965dcbd4dd1137f321d9266f2084 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Thu, 25 Apr 2024 11:23:06 +0200 Subject: [PATCH] Add: new resposive image gallery css --- archivist/static/css/main.css | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/archivist/static/css/main.css b/archivist/static/css/main.css index 7e35a7f..e104620 100644 --- a/archivist/static/css/main.css +++ b/archivist/static/css/main.css @@ -242,6 +242,95 @@ text-decoration: underline; } + +/*================================================================= + Responsive image gallery +=================================================================*/ + +.gallery-container { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 20px; /* Adjust the gap between items */ +} + +.gallery-item { + height: 20vh; + position: relative; /* Positioning context for the overlay */ + overflow: hidden; /* Ensure that the content does not overflow the set height */ + display: flex; /* Use Flexbox for vertical centering */ + justify-content: center; /* Center horizontally */ + align-items: center; /* Center vertically */ + border-radius: 1vmin; + border: 2px solid black; +} + +.gallery-item img { + max-height: 100%; + /* min-width: 50%; */ + object-fit: contain; + vertical-align: bottom; + border-radius: 1vmin; +} + +/* ADVANCED */ + +/* Portrait */ + +@media (max-aspect-ratio: 1/1) { + .gallery-item { + height: 30vh; + } +} + +/* Short screens */ + +@media (max-height: 480px) { + .gallery-item { + height: 80vh; + } +} + +/* Smaller screens in portrait */ + +@media (max-aspect-ratio: 1/1) and (max-width: 480px) { + .gallery-container { + flex-direction: row; + } + + .gallery-item { + height: auto; + width: 100%; + } + + .gallery-item img { + width: 100%; + max-height: 75vh; + min-width: 0; + } +} + +.overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.8); /* Semi-transparent black background */ + color: white; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + opacity: 0; /* Hide the overlay by default */ + transition: opacity 0.3s ease; /* Smooth transition for the overlay */ +} + +.gallery-item:hover .overlay { + opacity: 1; /* Show the overlay on hover */ +} + + /*================================================================= Site icon overlay on gallery =================================================================*/