Pure CSS Gallery

Size
3,817 Kb
Views
42,504

How do I make an pure css gallery?

Responsive gallery with pop-up lightboxes. Everything in pure CSS!. What is a pure css gallery? How do you make a pure css gallery? This script and codes were developed by Miro Karilahti on 07 July 2022, Thursday.

Pure CSS Gallery Previews

Pure CSS Gallery - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS Gallery</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
// The numbers are Unsplash It picture IDs
- var pics = [
- 1, 20, 635, 42,
- 180, 625, 201, 7,
- 48, 180, 534, 24
- ]
// Loop all pictures and print checkboxes and lightboxes for them
- var pic_id = 0
- each pic in pics - pic_id++ input(type="checkbox", id="pic-#{pic_id}") label.lightbox(for="pic-#{pic_id}") img(src="//unsplash.it/800/600?image=#{pic}")
.grid // Loop all pictures and print the actual images - var pic_id = 0 - each pic in pics - pic_id++ label.grid-item(for="pic-#{pic_id}") img(src="//unsplash.it/400/300?image=#{pic}") <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>

Pure CSS Gallery - Script Codes CSS Codes

*,
*:before,
*:after { box-sizing: border-box;
}
label[for] { cursor: pointer;
}
input[type="checkbox"] { display: none;
}
body { background-color: #000;
}
.lightbox, .grid { width: 100%; position: fixed; top: 0; left: 0;
}
.lightbox { z-index: 1; min-height: 100%; overflow: auto; transform: scale(0); transition: transform .5s ease-out;
}
.lightbox img { position: fixed; top: 50%; left: 50%; max-width: 96%; max-height: 96%; transform: translate(-50%, -50%); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
input[type="checkbox"]:checked + .lightbox { transform: scale(1);
}
input[type="checkbox"]:checked ~ .grid { opacity: .125;
}
.grid { display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; height: 100%; padding: 16px; overflow: auto; z-index: 0; background-color: #222; text-align: center; transition: opacity .75s;
}
.grid .grid-item { display: block; width: 25%; padding: 16px; opacity: .75; transition: opacity .5s;
}
.grid .grid-item:hover { opacity: 1;
}
@media screen and (max-width: 1280px) { .grid .grid-item { width: 33.3333%; }
}
@media screen and (max-width: 960px) { .grid .grid-item { width: 50%; }
}
@media screen and (max-width: 480px) { .grid .grid-item { width: 100%; }
}
.grid img { max-width: 100%; max-height: 100%; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
Pure CSS Gallery - Script Codes
Pure CSS Gallery - Script Codes
Home Page Home
Developer Miro Karilahti
Username miroot
Uploaded July 07, 2022
Rating 4.5
Size 3,817 Kb
Views 42,504
Do you need developer help for Pure CSS Gallery?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Miro Karilahti (miroot) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!