"pure css gallery"
Bootstrap 3.0.0 Snippet by evarevirus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<h1>Pure CSS Gallery</h1>
<section class="gallery">
<div class="carousel">
<input type="radio" id="image1" name="gallery-control" checked>
<input type="radio" id="image2" name="gallery-control">
<input type="radio" id="image3" name="gallery-control">
<input type="radio" id="image4" name="gallery-control">
<input type="checkbox" id="fullscreen" name="gallery-fullscreen-control"/>
<div class="wrap">
<figure>
<label for="fullscreen">
<img src="https://unsplash.it/1000/700/?random" alt="image1"/>
</label>
</figure>
<figure>
<label for="fullscreen">
<img src="https://unsplash.it/1200/980/?random" alt="image2"/>
</label>
</figure>
<figure>
<label for="fullscreen">
<img src="https://unsplash.it/1600/880/?random" alt="image3" />
</label>
</figure>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* TODO:
* clean up!
* ===============
* horizontal thumbnails
* at small screens
* and in fullscreen
* ===============
* create Mixins
* ===============
*/
@import "https://fonts.googleapis.com/css?family=Montserrat:400,700|Raleway:300,400";
/* colors */
html {
width: 100%;
height: 100%;
}
body {
background: #efefef;
color: #333;
font-family: "Raleway";
height: 100%;
}
body h1 {
text-align: center;
color: #428BFF;
font-weight: 300;
padding: 40px 0 20px 0;
margin: 0;
}
.gallery {
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
position: relative;
background: white;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

Is possible to add more than 4 images?

5alex02006 (0) - 7 years ago - Reply 0


I would think so. Just copy all the code with 'image4' and make it 'image5'

skyhighpn (-1) - 7 years ago - Reply 0


I tried but it didnt work, it adds a fifth miniview but once you click it, it redirects you to the first image, not sure why

5alex02006 (0) - 7 years ago - Reply 1


You edited the css too?

skyhighpn (-1) - 7 years ago - Reply 0


No, Im not sure what should I change in the css

5alex02006 (0) - 7 years ago - Reply 0


I can't say for sure, but probably this code:

.gallery input#image4:checked ~ .wrap figure {

-webkit-transform: translateX(-300%);

transform: translateX(-300%);

}

.gallery input#image4:checked ~ .wrap figure:not(:nth-of-type(4)) {

opacity: 0;

}

.gallery input#image4:checked ~ .thumbnails .slider {

-webkit-transform: translateY(300%);

transform: translateY(300%);

}

.gallery input#image4:checked ~ .thumbnails .thumb:nth-of-type(4) {

opacity: 1;

cursor: default;

}

copy that and change all the image4's to image5 to correspond to the html.

skyhighpn (-1) - 7 years ago - Reply 2


Nice man! Thanks, it worked, only one more thing you must do is to change the 300% to 400% and works just fine!

5alex02006 (0) - 7 years ago - Reply 0