Add: new resposive image gallery css

This commit is contained in:
Aroy-Art 2024-04-25 11:23:06 +02:00
parent 201065c5e4
commit fa1a7b35ad
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -242,6 +242,95 @@
text-decoration: underline; 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 Site icon overlay on gallery
=================================================================*/ =================================================================*/