<p>Hover <a class="link" href="">the link</a> for magic</p>
<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/ai" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
<a class="twitter" target="_top" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
:root {
--text: #2B3044;
--line: #275EFE;
--font-size: 16px;
--duration: .44s;
--duration-line: .84s;
}
p {
font-size: 18px;
margin: 0;
color: var(--text);
font-size: var(--font-size);
line-height: var(--font-size);
zoom: 1.5;
.link {
display: inline-block;
position: relative;
text-decoration: none;
color: inherit;
div {
overflow: hidden;
&:first-child {
display: flex;
overflow: hidden;
text-shadow: 0 var(--font-size) 0 var(--text);
}
&:last-child {
position: absolute;
pointer-events: none;
right: 0;
left: 0;
bottom: -3px;
height: 5px;
svg {
display: block;
position: absolute;
right: 0;
top: 0;
width: 300%;
height: 5px;
fill: none;
stroke: var(--line);
stroke-width: 1.5px;
stroke-linecap: round;
stroke-dasharray: 63.5px 128px;
stroke-dashoffset: var(--line-offset, 190.25px);
transform: translateX(var(--line-x)) translateZ(0);
transition: transform var(--line-d, 0s), stroke-dashoffset var(--line-d, 0s);
}
}
span {
display: block;
backface-visibility: hidden;
font-style: normal;
transition: transform var(--duration) ease;
transform: translateY(var(--m, 0));
$i: 1;
@while $i < 12 {
&:nth-child(#{$i}) {
transition-delay: $i / 20 + s;
}
$i: $i + 1;
}
}
}
&:hover {
--m: calc(var(--font-size) * -1);
--line-d: var(--duration-line);
--line-x: 65.66%;
--line-offset: 63.5px;
}
}
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
* {
box-sizing: inherit;
&:before,
&:after {
box-sizing: inherit;
}
}
// Center & dribbble
body {
min-height: 100vh;
display: flex;
font-family: 'Inter', Arial;
justify-content: center;
align-items: center;
background: #F6F8FF;
.dribbble {
position: fixed;
display: block;
right: 20px;
bottom: 20px;
img {
display: block;
height: 28px;
}
}
.twitter {
position: fixed;
display: block;
right: 64px;
bottom: 14px;
svg {
width: 32px;
height: 32px;
fill: #1da1f2;
}
}
}
View Compiled
document.querySelectorAll('.link').forEach(link => {
link.innerHTML = '<div><span>' + link.textContent.trim().split('').join('</span><span>') + '</span></div>'
link.querySelectorAll('span').forEach(s => s.innerHTML = s.textContent == ' ' ? ' ' : s.textContent)
link.insertAdjacentHTML('beforeend', '<div><svg preserveAspectRatio="none" viewBox="0 0 192 5"><path d="M191.246 4H129C129 4 127.781 4.00674 127 4C114.767 3.89447 108.233 1 96 1C83.7669 1 77.2327 3.89447 65 4C64.219 4.00674 63 4 63 4H0.751923" /></svg></div>')
});
This Pen doesn't use any external JavaScript resources.