lightbox.css
· 1.3 KiB · CSS
Raw
/* reset stuff */
div.gallery {
background: none !important;
border: none !important;
margin: 0;
padding: 0;
max-width: 100%;
}
details.lightbox {
background: none;
border: none;
margin: unset;
padding: unset;
box-shadow: none;
max-width: unset;
}
details.lightbox:before {
display: none;
height: 0;
width: 0;
margin: 0;
border: none;
box-shadow: none;
}
details.lightbox summary {
background: none;
display: list-item;
}
details.lightbox summary:before {
content: "";
}
/* the actual lightbox + gallery code */
details.lightbox {
display: inline-block;
}
details.lightbox summary {
cursor: pointer;
list-style-type: none;
}
div.gallery details.lightbox summary {
height: 100px;
width: 100px;
}
div.gallery details.lightbox summary img {
object-fit: cover;
width: 100%;
height: 100%;
}
details.lightbox > img {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
max-width: 95vw;
max-height: 95vh;
z-index: 5;
}
details.lightbox[open] summary, div.gallery details.lightbox[open] summary {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 3;
background: rgba(0,0,0,0.3);
backdrop-filter: blur(5px);
cursor: unset;
}
details.lightbox[open] summary img {
display: none;
}
body:has(details.lightbox[open]) {
overflow: hidden;
}
| 1 | /* reset stuff */ |
| 2 | |
| 3 | div.gallery { |
| 4 | background: none !important; |
| 5 | border: none !important; |
| 6 | margin: 0; |
| 7 | padding: 0; |
| 8 | max-width: 100%; |
| 9 | } |
| 10 | |
| 11 | details.lightbox { |
| 12 | background: none; |
| 13 | border: none; |
| 14 | margin: unset; |
| 15 | padding: unset; |
| 16 | box-shadow: none; |
| 17 | max-width: unset; |
| 18 | } |
| 19 | |
| 20 | details.lightbox:before { |
| 21 | display: none; |
| 22 | height: 0; |
| 23 | width: 0; |
| 24 | margin: 0; |
| 25 | border: none; |
| 26 | box-shadow: none; |
| 27 | } |
| 28 | |
| 29 | details.lightbox summary { |
| 30 | background: none; |
| 31 | display: list-item; |
| 32 | } |
| 33 | |
| 34 | details.lightbox summary:before { |
| 35 | content: ""; |
| 36 | } |
| 37 | |
| 38 | /* the actual lightbox + gallery code */ |
| 39 | |
| 40 | details.lightbox { |
| 41 | display: inline-block; |
| 42 | } |
| 43 | |
| 44 | details.lightbox summary { |
| 45 | cursor: pointer; |
| 46 | list-style-type: none; |
| 47 | } |
| 48 | |
| 49 | div.gallery details.lightbox summary { |
| 50 | height: 100px; |
| 51 | width: 100px; |
| 52 | } |
| 53 | |
| 54 | div.gallery details.lightbox summary img { |
| 55 | object-fit: cover; |
| 56 | width: 100%; |
| 57 | height: 100%; |
| 58 | } |
| 59 | |
| 60 | details.lightbox > img { |
| 61 | position: fixed; |
| 62 | left: 50%; |
| 63 | top: 50%; |
| 64 | transform: translate(-50%, -50%); |
| 65 | max-width: 95vw; |
| 66 | max-height: 95vh; |
| 67 | z-index: 5; |
| 68 | } |
| 69 | |
| 70 | details.lightbox[open] summary, div.gallery details.lightbox[open] summary { |
| 71 | position: fixed; |
| 72 | left: 0; |
| 73 | top: 0; |
| 74 | width: 100vw; |
| 75 | height: 100vh; |
| 76 | z-index: 3; |
| 77 | background: rgba(0,0,0,0.3); |
| 78 | backdrop-filter: blur(5px); |
| 79 | cursor: unset; |
| 80 | } |
| 81 | |
| 82 | details.lightbox[open] summary img { |
| 83 | display: none; |
| 84 | } |
| 85 | |
| 86 | body:has(details.lightbox[open]) { |
| 87 | overflow: hidden; |
| 88 | } |