Skip to content

Instantly share code, notes, and snippets.

@zahachtah
Created May 9, 2019 19:25
Show Gist options
  • Save zahachtah/306b2cd51bb210ef0699cd526122ab67 to your computer and use it in GitHub Desktop.
Save zahachtah/306b2cd51bb210ef0699cd526122ab67 to your computer and use it in GitHub Desktop.
Accordion Image Gallery
<div class="container">
<div class="gallery-wrap">
<div class="item item-1"><div class="text">test</div></div>
<div class="item item-2"><div class="text">another</div></div>
<div class="item item-3"><div class="text">whynot</div></div>
<div class="item item-4"><div class="text">cool</div></div>
<div class="item item-5"><div class="text">stuff</div></div>
<div class="item item-6"><div class="text">another</div></div>
<div class="item item-7"><div class="text">whynot</div></div>
<div class="item item-8"><div class="text">cool</div></div>
<div class="item item-9"><div class="text">stuff</div></div>
</div>
</div>
</div>
<div class="social">
<a href="https://twitter.com/StefCharle" target="_blank">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/149103/twitter.svg" alt="">
</a>
</div>
html,body{
width: 100%;
height: 100%;
}
.container{
padding: 75px 0;
margin: 0 auto;
width: 100%;
}
h1{
position: relative;
margin-bottom: 45px;
font-family: 'Oswald', sans-serif;
font-size: 44px;
text-transform: uppercase;
color: #424242;
vertical-align: left;
text-anchor: left;
transform: rotate(-90deg)
}
.gallery-wrap {
display: flex;
flex-direction: row;
width: 100%;
height: 50vh;
}
.item {
flex: 1;
height: 100%;
background-position: center;
background-size: cover;
background-repeat: none;
transition: flex 0.8s ease;
filter: grayscale(100%);
&:hover{
flex: 12;
filter: grayscale(0%);
}
}
.item:hover .text {
color:white;
}
.text {
position: absolute;
float:left;
bottom: -30px;
transform: rotate(-90deg);
font-family: 'Oswald', sans-serif;
font-size: 34px;
text-transform: uppercase;
text-anchor:left;
color: white;
transform-origin: left top 0;
font-style: italic;
}
.item-1 {
background-image: url('https://images.unsplash.com/photo-1499198116522-4a6235013d63?auto=format&fit=crop&w=1233&q=80');
}
.item-2 {
background-image: url('https://images.unsplash.com/photo-1492760864391-753aaae87234?auto=format&fit=crop&w=1336&q=80');
}
.item-3 {
background-image: url('https://images.unsplash.com/photo-1503631285924-e1544dce8b28?auto=format&fit=crop&w=1234&q=80');
}
.item-4 {
background-image: url('https://images.unsplash.com/photo-1510425463958-dcced28da480?auto=format&fit=crop&w=1352&q=80');
}
.item-5 {
background-image: url('https://images.unsplash.com/photo-1503602642458-232111445657?auto=format&fit=crop&w=1234&q=80');
}
.item-6 {
background-image: url('https://images.unsplash.com/photo-1492760864391-753aaae87234?auto=format&fit=crop&w=1336&q=80');
}
.item-7 {
background-image: url('https://images.unsplash.com/photo-1503631285924-e1544dce8b28?auto=format&fit=crop&w=1234&q=80');
}
.item-8 {
background-image: url('https://images.unsplash.com/photo-1510425463958-dcced28da480?auto=format&fit=crop&w=1352&q=80');
}
.item-9 {
background-image: url('https://images.unsplash.com/photo-1503602642458-232111445657?auto=format&fit=crop&w=1234&q=80');
}
.social{
position: absolute;
right: 35px;
bottom: 0;
img{
display: block;
width: 32px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment