Skip to content

Instantly share code, notes, and snippets.

@gigocabrera
Created January 5, 2017 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gigocabrera/3404c739f539f2b651325d9fd98a164d to your computer and use it in GitHub Desktop.
Save gigocabrera/3404c739f539f2b651325d9fd98a164d to your computer and use it in GitHub Desktop.
2017-01-03
/* Responsive Tiled Photo Gallery */
.galleryWrap
{
overflow: hidden;
margin: 10px;
}
.pictureBox
{
float: left;
position: relative;
width: 20%;
padding-bottom: 20%;
}
.innerBox
{
position: absolute;
left: 10px;
right: 10px;
top: 10px;
bottom: 10px;
overflow: hidden;
}
.innerBox img
{
width: 100%;
}
.innerBox .titleBox
{
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin-bottom: -50px;
background: #000;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
padding: 10px;
text-align: center;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.innerBox:hover .titleBox
{
margin-bottom: 0;
}
@media only screen and (max-width : 480px)
{
/* Smartphone view: 1 tile */
.pictureBox
{
width: 100%;
padding-bottom: 100%;
}
}
@media only screen and (max-width : 650px) and (min-width : 481px)
{
/* Tablet view: 2 tiles */
.pictureBox
{
width: 50%;
padding-bottom: 50%;
}
}
@media only screen and (max-width : 1050px) and (min-width : 651px)
{
/* Small desktop / ipad view: 3 tiles */
.pictureBox
{
width: 33.3%;
padding-bottom: 33.3%;
}
}
@media only screen and (max-width : 1290px) and (min-width : 1051px)
{
/* Medium desktop: 4 tiles */
.pictureBox
{
width: 25%;
padding-bottom: 25%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment