<div class="button">Button</div>
<p><a>Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia nostrum placeat consequatur deserunt velit ducimus possimus commodi temporibus debitis quam, molestiae laboriosam sit repellendus sed sapiente quidem quod accusantium vero.</a></p>
html,
body {
width: 100%;
height: 100%;
display: flex;
overflow: hidden;
}
.button {
position: fixed;
top: 0;
left: 0;
width: 120px;
height: 64px;
line-height: 64px;
text-align: center;
border: 1px solid #eee;
cursor: pointer;
transition: .3s all;
z-index: 10;
&:hover {
background: #eee;
}
}
p {
margin: 50px auto;
width: 500px;
height: 250px;
font-size: 24px;
line-height: 1.5;
color: #666;
overflow: hidden;
}
a {
background:
linear-gradient(90deg, #ff5722, #ff5722),
linear-gradient(90deg, #aaa, #aaa);
// background: linear-gradient(90deg, #ff3c41, #fc0, #8500d8);
background-size: 100% 100%, 0 100px;
// background-size: 100% 100%;
background-repeat: no-repeat;
background-position: 100% 100%, 0 100%;
// background-position: 100% 100%;
cursor: pointer;
color: transparent;
background-clip: text;
line-height: 3;
opacity: 0;
}
a::before {
content: "";
position: fixed;
background: rgba(0, 0, 0, .8);
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
transition: .3s all linear;
opacity: 0;
}
.button:hover ~ p a {
transition: 1.2s background .3s ease-out, .8s line-height ease-out, .6s opacity ease-in;
background-size: 0 100px, 100% 100%;
// background-position: 0 100%, 0 100%;
// background-size: 0 100px;
color: transparent;
line-height: 1;
opacity: 1;
}
.button:hover ~ p a::before {
opacity: 1;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.