<main>
<span><p>hover or tap me</p></span>
</main>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html,
body {
font-family: 'Fira Code', monospace;
width: 100%;
height: 100%;
font-size: 16px;
}
main {
display: flex;
height: 100%;
align-items: center;
justify-content: center;
}
p {
cursor: pointer;
position: relative;
display: inline-block;
font-size: 3rem;
background: linear-gradient(to bottom, #000, #000 60%, #fff 60%, #fff 100%);
background-clip: text;
background-clip: text;
color: transparent;
background-repeat: no-repeat;
transition: background 0.2s ease-out;
white-space: nowrap;
}
span {
position: relative;
}
span:before {
content: "";
position: absolute;
left: 0;
right: 0;
height: 15px;
background: #000;
bottom: 9px;
transition: all 0.2s ease-out;
}
p:hover {
background-position: 0 11px;
}
span:hover:before {
transform: translateY(10px)
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.