<div class="button">
<a href="#">
Often Unseen
<span class="shift">›</span>
</a>
<div class="mask"></div>
</div>
:root {
--bg-body: rgba(25, 25, 25, 1);
--bg-body-gradient: radial-gradient(30% 90% ellipse at bottom center, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 100%);
--bg-body-hover: rgba(33, 33, 33, 1);
--bg-button: rgba(255, 255, 255, 0);
--bg-button-hover: rgba(255, 255, 255, 0.05);
--bg-button-active: rgba(255, 255, 255, 1.0);
--bg-mask: rgba(255, 255, 255, 0.5);
--bg-mask-hover: rgba(255, 255, 255, 1.0);
--border-button: rgba(255, 255, 255, 0.2);
--border-button-hover: rgba(255, 255, 255, 1.0);
--color-button: rgba(255, 255, 255, 0.6);
--color-button-hover: rgba(255, 255, 255, 1.0);
--color-button-active: var(--body-bg);
--font-button: "Varela Round", sans-serif;
--shadow-button-hover: 0 0 0.3125rem rgba(255, 255, 255, 0.8);
--transition-easing: cubic-bezier(0.19, 1, 0.22, 1);
}
body {
align-items: center;
background-color: var(--bg-body);
background-image: var(--bg-body-gradient);
display: flex;
height: 100vh;
justify-content: center;
margin: 0;
padding: 0;
transition: background-color 2s var(--transition-easing);
}
body.hover {
background-color: var(--bg-body-hover);
}
.button {
background-color: var(--bg-button);
border: 0.125rem solid var(--border-button);
cursor: pointer;
letter-spacing: 0.2125rem;
line-height: 1;
overflow: hidden;
padding: 1.25rem 1.875rem;
position: relative;
text-align: center;
text-transform: uppercase;
transition:
background-color 0.3s var(--transition-easing),
border 1s var(--transition-easing),
color 0.6s var(--transition-easing);
user-select: none;
}
.button a {
color: var(--color-button);
font-family: var(--font-button);
position: relative;
text-decoration: none;
white-space: nowrap;
z-index: 2;
}
.button .mask {
background-color: var(--bg-mask);
height: 6.25rem;
position: absolute;
transform: translate3d(-120%, -3.125rem, 0) rotate3d(0, 0, 1, 45deg);
transition: all 1.1s var(--transition-easing);
width: 12.5rem;
z-index: 1;
}
.button .shift {
display: inline-block;
transition: all 1.1s var(--transition-easing);
vertical-align: text-top;
}
.button:hover {
background-color: var(--bg-button-hover);
border-color: var(--border-button-hover);
box-shadow: var(--shadow-button-hover);
}
.button:hover a {
color: var(--color-button-hover);
}
.button:hover .mask {
background-color: var(--bg-mask-hover);
transform: translate3d(120%, -6.25rem, 0) rotate3d(0, 0, 1, 90deg);
}
.button:hover .shift {
transform: translateX(0.3125rem);
}
.button:active {
background-color: var(--bg-button-active);
}
.button:active a {
color: var(--color-button-active);
}
/*
.button:hover {
background-image: url('http://.com/img/codepen/savvy.jpg');
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
*/
const body = document.body;
const btn = document.querySelectorAll('.button')[0];
btn.addEventListener('mouseenter', () => {
body.classList.add('hover');
});
btn.addEventListener('mouseleave', () => {
body.classList.remove('hover');
});
This Pen doesn't use any external JavaScript resources.