Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save okeeffe/9247950 to your computer and use it in GitHub Desktop.
Save okeeffe/9247950 to your computer and use it in GitHub Desktop.

CSS3 hover text animate in div

A Pen by Richard Bray on CodePen.

License.

So awesome I had to save it as a gist for future reference. Nice one Richard!

<div class="blue-btn">
<a class="first-link" href="">
First Text
</a>
<a href="">
Second Text
</a>
</div>
.blue-btn a{
color: white;
text-decoration:none;
text-align: center;
display:block; /* important */
}
.blue-btn, .first-link{
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-ms-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.blue-btn{
height: 64px;
font: normal normal 700 1em/4em Arial,sans-serif;
overflow: hidden;
width: 200px;
background-color: #3b5998;
}
.blue-btn:hover{
background-color: #003D99;
}
.blue-btn a:hover{
text-decoration: none;
}
.first-link{
margin-top: 0em;
}
.blue-btn:hover .first-link{
margin-top: -4em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment