HTML
<div class="wrapper">
<div class="hovereffect">
<img class="img-responsive" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/242518/hil.gif" alt="">
<div class="overlay">
<h2>Hillary Clinton</h2>
<p><a href="#">VOTE</a></p>
</div>
</div>
</div>
<div class="wrapper">
<div class="hovereffect">
<img class="img-responsive" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/242518/tru.gif" alt="">
<div class="overlay">
<h2>Donald Trump</h2>
<p><a href="#">VOTE</a></p>
</div>
</div>
</div>
CSS
html, body {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background: #3884d0;
font-family: 'Roboto Mono', monospace;
}
.wrapper {
width: 350px;
height: 250px;
border: 6px solid #fff;
box-shadow: 0px 0px 24px -2px #333;
}
.wrapper:first-child {
margin-right: 30px;
}
.hovereffect {
width: 100%;
height: 100%;
float: left;
overflow: hidden;
position: relative;
text-align: center;
cursor: default;
}
.hovereffect .overlay {
position: absolute;
overflow: hidden;
width: 80%;
height: 80%;
left: 10%;
top: 10%;
border-bottom: 1px solid #FFF;
border-top: 1px solid #FFF;
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
-webkit-transform: scale(0,1);
-ms-transform: scale(0,1);
transform: scale(0,1);
}
.hovereffect:hover .overlay {
opacity: 1;
filter: alpha(opacity=100);
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.hovereffect img {
display: block;
position: relative;
transition: all 0.35s;
width: 100%;
}
.hovereffect:hover img {
filter: brightness(0.6);
-webkit-filter: brightness(0.6);
}
.hovereffect h2 {
text-transform: uppercase;
text-align: center;
position: relative;
font-size: 30px;
background-color: transparent;
color: #FFF;
padding: 1em 0;
opacity: 0;
filter: alpha(opacity=0);
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
-webkit-transform: translate3d(0,-100%,0);
transform: translate3d(0,-100%,0);
}
.hovereffect a,
.hovereffect p {
color: #FFF;
padding: 1em 0;
font-size: 18px;
font-weight: bold;
text-decoration: none;
opacity: 0;
filter: alpha(opacity=0);
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
-webkit-transform: translate3d(0,100%,0);
transform: translate3d(0,100%,0);
}
.hovereffect:hover a,
.hovereffect:hover p,
.hovereffect:hover h2 {
opacity: 1;
filter: alpha(opacity=100);
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
a:hover {
text-decoration: underline;
}
6 Responses