<div class="button">My Button</div>
<div><a href="https://www.sitepoint.com/community/t/css-hover-with-background-image-not-working/368076?u=sama74">https://www.sitepoint.com/community/t/css-hover-with-background-image-not-working/368076?u=sama74</a></div>
.button {
position: relative;
max-width: 66em;
padding: 15px;
background: rgba(0, 100, 250, 1);
color: white;
border-radius: 7px;
margin-bottom: 35px;
transition: 2s;
}
.button:hover {
background: rgba(0, 100, 250, 0);
}
.button::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
background-image: linear-gradient(
to right top,
#2525a7,
#222299,
#1f1f8b,
#1c1c7d,
#191970
);
border-radius: 7px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.