<a href="#" class="example">
	<figure>
		<img src="https://www.ameamelog.com/wp/wp-content/uploads/2019/08/css-scale_dummy.jpg" alt="">
		<figcaption>Example</figcaption>
	</figure>
</a>
body {
	min-height: 100vh;
	margin: 0;
	padding: 0;
	display: flex;
	justify-content: center;
	align-items: center;
}
img {
	vertical-align: bottom;
}

.example {
	color: #fff;
	display: flex;
	justify-content: center;
	align-items: center;
	position: relative;
}
.example::before {
	content: "";
	width: 100%;
	height: 100%;
	background: -moz-linear-gradient(-90deg, #000000 0%, #000000 25%, #EE9AE5 50%, #5961F9 75%, #FF52E5 100%);
	background: -webkit-linear-gradient(-90deg, #000000 0%, #000000 25%, #EE9AE5 50%, #5961F9 75%, #FF52E5 100%);
	background: linear-gradient(90deg, #000000 0%, #000000 25%, #EE9AE5 50%, #5961F9 75%, #FF52E5 100%);
	background-size: 400% 400%;
	background-repeat: no-repeat;
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	opacity: .5;
	transition: .5s;
}
.example:hover::before {
	background-position: 100% 100%;
}
.example figure {
	margin: 0;
	position: relative;
}
.example figcaption {
	font-size: 24px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 3;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.