<div>
  
  <div class="on-light">
    <button class="border-gradient border-gradient-purple">
      I have a gradient
    </button>
  </div>
  
  <div class="on-dark">
    <button class="border-gradient border-gradient-purple">
      I have a gradient
    </button>
  </div>
  
  <div class="on-light">
    <button class="border-gradient border-gradient-green">
      I have a gradient
    </button>
  </div>
  
  <div class="on-dark">
    <button class="border-gradient border-gradient-green">
      I have a gradient
    </button>
  </div>
  
</div>
button {
  background: none;
  text-decoration: inherit;
  font-family: system-ui;
  font-size: 1rem;
  padding: 1rem 2rem;
}

.border-gradient {
  border: 10px solid;
  border-image-slice: 1;
  border-width: 5px;
}
.border-gradient-purple {
  border-image-source: linear-gradient(to left, #743ad5, #d53a9d);
}
.border-gradient-green {
  border-image-source: linear-gradient(to left, #00C853, #B2FF59);
}

body {
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  > div {
    width: 100%;
    text-align: center;
  }
  > div > div {
    width: 100%;
    padding: 1rem;
  }
}

.on-dark {
  background: #222;
  button {
    color: white;
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.

Packages

This Pen doesn't use any packages.