Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2017 13:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4fda7930d12b8342ed9f694891d1ecfd to your computer and use it in GitHub Desktop.
Save anonymous/4fda7930d12b8342ed9f694891d1ecfd to your computer and use it in GitHub Desktop.
(Cool) Button Hover Effect
<a href="http://tiagoalexandrelopes.com/" title="Visit my website" targe="_blank" class="button">My website</a>
@import url('https://fonts.googleapis.com/css?family=Montserrat:600');
html {
font-family: sans-serif;
line-height: 1.15;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
background: #FFF;
font-size: 62.5%;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: transparent;
box-sizing: border-box;
}
body {
background-color: #FFF;
color: #45555F;
font-weight: 400;
font-size: 1.6rem;
line-height: 160%;
font-family: 'Montserrat', sans-serif;
}
a{
text-decoration: none;
display: block;
}
.button{
color: #222;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-transform: uppercase;
letter-spacing: .2em;
-webkit-transition: all .4s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all .4s cubic-bezier(0.645, 0.045, 0.355, 1);
font-size: 0.875em;
width: 140px;
text-align: center;
padding: 10px 15px;
}
.button:hover{
letter-spacing: 0;
color: white
}
.button:after{
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 0;
background: #6284FF;
z-index: -1;
-webkit-transition: all .4s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all .4s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.button:hover:after{
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment