Skip to content

Instantly share code, notes, and snippets.

@bmoredrew
Last active August 29, 2015 14:02
Show Gist options
  • Save bmoredrew/52f2be78611e036a9f3c to your computer and use it in GitHub Desktop.
Save bmoredrew/52f2be78611e036a9f3c to your computer and use it in GitHub Desktop.
In the template:
<ul class="cf" id="port-grid">
<li class="web">
<a href="#">
<img src="img/img1.jpg" alt="">
<span>
<span>Title</span>
<span>Excerpt</span>
</span>
</a>
</li>
<li class="print">
<a href="#">
<img src="img/img2.jpg" alt="">
<span>
<span>Title</span>
<span>Excerpt</span>
</span>
</a>
</li>
</ul>
In CSS:
ul {
padding-left: 0;
margin: 0 0 0 -23px;
}
ul li {
list-style: none;
float: left;
margin-left: 22px;
margin-bottom: 20px;
display: inline-block;
overflow: hidden;
}
ul li a {
display: block;
overflow: hidden;
position: relative;
}
ul li a:hover > span {
opacity: 1;
}
ul li a img {
display: block;
width: 100%;
position: relative;
z-index: 5;
}
ul li a > span {
display: block;
opacity: 0;
-webkit-transition: opacity 200ms;
-moz-transition: opacity 200ms;
-o-transition: opacity 200ms;
transition: opacity 200ms;
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
top: 0;
left: 0;
background: url(bg.jpg) no-repeat;
background-size: cover;
padding: 43px 30px 43px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
ul li a > span > span:first-child {
font-size: 30px;
color: #ffffff;
line-height: 30px;
margin-bottom: 21px;
display: block;
font-family: 'oswald', sans-serif;
font-weight: 400;
}
ul li a > span span {
font-family: 'district_pro';
font-size: 22px;
line-height: 24px;
margin: 0 0 10px;
font-weight: 300;
color: #ffffff;
display: block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment