<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: 5px;
  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::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(2 * var(--borderWidth));
  padding: var(--borderWidth);
  background: linear-gradient(
    60deg,
    #f79533,
    #f37055,
    #ef4e7b,
    #a166ab,
    #5073b8,
    #1098ad,
    #07b39b,
    #6fba82
  );
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.