<h1>My favourite link hover styles</h1>
<section class="links">
<!--[[[https://codepen.io/tprodriguez/pen/GmRdWd]]] -->
<a class="link wipe" href="#">Bella</a>
<a class="link underline" href="#">Kiana</a>
<a id="slide-link" class="link slide" href="#"><span>Enrico</span></a>
<a class="link opacity" href="#">Vincenzo</a>
</section>
@import url(https://fonts.googleapis.com/css?family=Oswald);
body {
/*background: #1e7a90;*/
/*background: #0078a4;*/
background: #00c17f;
color: #fff;
font-family: "Oswald", Arial, sans-serif;
text-align: center;
}
h1 {
width: 100%;
text-align: center;
letter-spacing: 0.02em;
margin: 2em 0;
}
.links {
width: 90%;
margin: 0 auto;
}
.link {
display: inline-block;
vertical-align: top;
width: 100px;
height: 34px;
line-height: 36px;
text-transform: uppercase;
text-decoration: none;
color: #fff;
letter-spacing: 0.1em;
text-align: center;
font-size: 0.8rem;
margin: 10px;
position: relative;
}
.link span {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
text-align: center;
}
.wipe, .slide, .opacity {
border: 2px solid #fff;
border-radius: 4px;
overflow: hidden;
}
.opacity {
-webkit-transition: background-color 0.3s linear, color 0.3s linear;
transition: background-color 0.3s linear, color 0.3s linear;
background: rgba(255, 255, 255, 0);
}
.opacity:hover {
color: #124a58;
background: rgba(255, 255, 255, 0.9);
}
.wipe {
-webkit-transition: color 0.3s ease-out;
transition: color 0.3s ease-out;
}
.wipe::after {
width: 100%;
height: 100%;
display: block;
background-color: #fff;
content: " ";
position: absolute;
top: 0;
-webkit-transition: -webkit-transform 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
transition: -webkit-transform 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
transition: transform 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
transition: transform 0.2s cubic-bezier(0.215, 0.61, 0.355, 1), -webkit-transform 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
-webkit-transform: translateY(34px);
transform: translateY(34px);
z-index: -1;
}
.wipe:hover {
color: #124a58;
}
.wipe:hover::after {
-webkit-transform: translateY(0px);
transform: translateY(0px);
}
.underline {
border: 2px solid transparent;
}
.underline::after {
width: 0%;
height: 2px;
display: block;
background-color: #fff;
content: " ";
position: absolute;
top: 34px;
left: 50%;
-webkit-transition: left 0.2s cubic-bezier(0.215, 0.61, 0.355, 1), width 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
transition: left 0.2s cubic-bezier(0.215, 0.61, 0.355, 1), width 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.underline:hover::after {
width: 100%;
height: 2px;
display: block;
background-color: #fff;
content: " ";
position: absolute;
top: 34px;
left: 0;
}
View Compiled
//JavaScript code for Slide functionality
var $slideLink = $("#slide-link"),
slideLinkText = $slideLink.find("span")[0];
$slideLink.on("mouseenter", linkOver);
function linkOver() {
TweenLite.to(slideLinkText, 0.3, {y: -25, ease: Cubic.easeIn, onComplete: function() {
TweenLite.fromTo(slideLinkText, 0.3, {y: 25}, {y: 0, ease: Cubic.easeOut})
}});
}
This Pen doesn't use any external CSS resources.