recettes/assets/css/extended/hugo-easy-gallery.css
2025-10-06 19:21:06 +02:00

160 lines
3.9 KiB
CSS
Executable file

/*
Hugo Easy Gallery - from static/css/hugo-easy-gallery.css
Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
*/
/*
Grid Layout Styles
*/
.gallery {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin: 10px;
max-width: 100%;
}
.gallery .box {
position: relative;
flex: 1 1 calc(33.333% - 10px); /* Default: 3 items per row on PC */
aspect-ratio: 1; /* Maintains square aspect ratio */
min-width: 200px; /* Minimum width before wrapping */
}
/* Responsive breakpoints */
@media (max-width: 768px) {
.gallery .box {
flex: 1 1 calc(50% - 10px); /* 2 items per row on tablets */
}
}
@media (max-width: 480px) {
.gallery .box {
flex: 1 1 100%; /* 1 item per row on mobile */
}
}
/*
Transition styles
*/
.gallery.hover-transition figure,
.gallery.hover-effect-zoom .img,
.gallery:not(.caption-effect-appear) figcaption,
.fancy-figure:not(.caption-effect-appear) figcaption {
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
/*
Figure styles
*/
figure {
position: relative; /* purely to allow absolution positioning of figcaption */
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.gallery figure {
position: absolute;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
}
.gallery.hover-effect-grow figure:hover {
transform: scale(1.05);
}
.gallery.hover-effect-shrink figure:hover {
transform: scale(0.95);
}
.gallery.hover-effect-slidedown figure:hover {
transform: translateY(5px);
}
.gallery.hover-effect-slideup figure:hover {
transform: translateY(-5px);
}
/*
img / a styles
*/
.gallery .img {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
}
.gallery figure {
border-radius: var(--radius);
box-shadow: 0px 3px 5px 0 rgba(0, 0, 0, 0.3);
}
.gallery.hover-effect-zoom figure:hover {
transform: scale(1.03);
}
.gallery img {
display: none; /* only show the img if not inside a gallery */
}
figure a {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
figure img {
box-shadow: 0px 2px 5px 0 rgba(0, 0, 0, 0.3);
}
/*
figcaption styles
*/
.gallery figcaption,
.fancy-figure figcaption {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: #000;
color: #FFF;
text-align: center;
font-size: 100%; /* change this if you want bigger text */
background: rgba(0, 0, 0, 0.5);
opacity: 1;
cursor: pointer;
}
.gallery.caption-position-none figcaption,
.fancy-figure.caption-position-none figcaption {
display: none;
}
.gallery.caption-position-center figcaption,
.fancy-figure.caption-position-center figcaption {
top: 0;
padding: 40% 5px;
}
.gallery.caption-position-bottom figcaption,
.fancy-figure.caption-position-bottom figcaption {
padding: 5px;
}
.gallery.caption-effect-fade figure:not(:hover) figcaption,
.gallery.caption-effect-appear figure:not(:hover) figcaption,
.fancy-figure.caption-effect-fade figure:not(:hover) figcaption,
.fancy-figure.caption-effect-appear figure:not(:hover) figcaption {
background: rgba(0, 0, 0, 0);
opacity: 0;
}
.gallery.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption,
.fancy-figure.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption {
margin-bottom: -100%;
}
.gallery.caption-effect-slide.caption-position-center figure:not(:hover) figcaption,
.fancy-figure.caption-effect-slide.caption-position-center figure:not(:hover) figcaption {
top: 100%;
}
.post-content figure figcaption p,
.post-content .gallery figcaption p,
.post-content .fancy-figure figcaption p {
margin: 0px 0px 0px 0px; /* override style in theme */
font-size: 0.8em;
}