<div class="card"> Gradient Border</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #557;
padding: 20px;
display: grid;
place-content: center;
}
.card {
--borderWidth: 4px;
position: relative;
background: #fff;
width: 40vw;
aspect-ratio: 4 / 3;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
font-size: clamp(20px, 3vw + 2rem, 30px);
}
.card::after {
content: "";
position: absolute;
inset: calc(-1 * var(--borderWidth));
background: linear-gradient(
60deg,
#f79533,
#f37055,
#ef4e7b,
#a166ab,
#5073b8,
#1098ad,
#07b39b,
#6fba82
);
border-radius: calc(2 * var(--borderWidth));
z-index: -1;
animation: animatedgradient 3s ease alternate infinite;
background-size: 400% 400%;
}
@keyframes animatedgradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.