Last active
December 11, 2023 11:39
-
-
Save pduchnovsky/8f4e0b728a23148c576c3aa32a007b29 to your computer and use it in GitHub Desktop.
CSS Gallery functionality for practically any SSG | https://duchnovsky.com/2020/11/gallery-function-css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img { | |
height: auto; | |
pointer-events: none; | |
-webkit-touch-callout: none; /* iOS Safari */ | |
-webkit-user-select: none; /* Safari */ | |
-khtml-user-select: none; /* Konqueror HTML */ | |
-moz-user-select: none; /* Old versions of Firefox */ | |
-ms-user-select: none; /* Internet Explorer/Edge */ | |
user-select: none; /* Non-prefixed version, currently | |
supported by Chrome, Edge, Opera and Firefox */ | |
} | |
img[alt~="_gallery"] { | |
-moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, .5), 0px 0px 10px rgba(0, 0, 0, 0.2); | |
-webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, .5), 0px 0px 10px rgba(0, 0, 0, 0.2); | |
box-shadow: 0px 0px 3px rgba(0, 0, 0, .5), 0px 0px 10px rgba(0, 0, 0, 0.2); | |
border-radius: 5px; | |
margin-bottom: 2%; | |
} | |
/* Aligning images only on tablet/pc, not mobile. */ | |
@media (min-width: 550px) { | |
img[alt~="_gallery"] { | |
max-width: 49%; | |
} | |
img[alt$=">"] { | |
float: right; | |
} | |
img[alt$="<"] { | |
float: left; | |
} | |
img[alt$="><"] { | |
display: block; | |
margin: auto; | |
float: none; | |
} | |
} | |
/* Cleanup after gallery image */ | |
p::after { | |
content: ""; | |
clear: both; | |
display: table; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment