A Pen by Aaron Iker on CodePen.
DEMO https://codemyui.com/underline-to-arrow-multiline-link-hover-effect/
<a href="" class="underline"> | |
<span>Link here</span><svg viewBox="0 0 13 20"><polyline points="0.5 19.5 3 19.5 12.5 10 3 0.5" /></svg> | |
</a> | |
<a href="" class="underline"> | |
<span>Link here with multiple lines</span><svg viewBox="0 0 13 20"><polyline points="0.5 19.5 3 19.5 12.5 10 3 0.5" /></svg> | |
</a> | |
<!-- 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="_blank" 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> |
.underline { | |
--line: #646B8C; | |
--color: #2B3044; | |
text-decoration: none; | |
color: var(--color); | |
position: relative; | |
span { | |
background-image: linear-gradient(0deg, var(--line) 0%, var(--line) 100%); | |
background-position: 100% 100%; | |
background-repeat: no-repeat; | |
background-size: var(--background-size, 100%) 1px; | |
transition: background-size .2s linear var(--background-delay, .15s); | |
font-size: 16px; | |
line-height: 20px; | |
transform: translateZ(0); | |
} | |
svg { | |
vertical-align: top; | |
display: inline; | |
line-height: 1; | |
width: 13px; | |
height: 20px; | |
position: relative; | |
left: -2px; | |
fill: none; | |
stroke-linecap: round; | |
stroke-linejoin: round; | |
stroke-width: 1px; | |
stroke: var(--line); | |
stroke-dasharray: 7.95 30; | |
stroke-dashoffset: var(--stroke-dashoffset, 46); | |
transition: stroke-dashoffset var(--stroke-duration, .15s) var(--stroke-easing, linear) var(--stroke-delay, 0s); | |
} | |
&:hover { | |
--background-size: 0%; | |
--background-delay: 0s; | |
--stroke-dashoffset: 26; | |
--stroke-duration: .3s; | |
--stroke-easing: cubic-bezier(.3, 1.5, .5, 1); | |
--stroke-delay: .195s; | |
} | |
} | |
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; | |
flex-direction: column; | |
background: #F6F8FF; | |
.underline { | |
width: 140px; | |
margin: 16px 0; | |
} | |
.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; | |
} | |
} | |
} |
<link href="https://fonts.googleapis.com/css?family=Inter:400,500,600,700&display=swap" rel="stylesheet" /> |