<h1>Favorite link styles</h1>
<section class="links">
<!-- you can include the HTML from other pens in your pen -->
[[[https://codepen.io/team/codepen/pen/PZOVdL/]]]
</section>
/* you can import CSS from other pens - we'll import color and typography styles from this pen */
@import url(//codepen.io/team/codepen/pen/NxwJpr.css);
.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;
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 {
transition: background-color 0.3s linear, color 0.3s linear;
background: rgba(255,255,255,0);
&:hover {
color: #124a58;
background: rgba(255,255,255,0.9);
}
}
.wipe {
transition: color 0.3s ease-out;
&::after {
width: 100%;
height: 100%;
display: block;
background-color: #fff;
content: " ";
position: absolute;
top: 0;
transition: transform 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);;
transform: translateY(34px);
z-index: -1;
}
&:hover {
color: #124a58;
&::after {
transform: translateY(0px);
}
}
}
.underline {
border: 2px solid transparent;
&::after {
width: 0%;
height: 2px;
display: block;
background-color: #fff;
content: " ";
position: absolute;
top: 34px;
left: 50%;
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);
}
&:hover {
&::after {
width: 100%;
height: 2px;
display: block;
background-color: #fff;
content: " ";
position: absolute;
top: 34px;
left: 0;
}
}
}
View Compiled
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.