<div class="parent">
  <button class="btn-gradient-1">Button One</button>
  <button class="btn-gradient-2">Button Two</button>
</div>
/* -------------------------------- 

šŸ’” How to create gradient borders in CSS
šŸ”— https://codyhouse.co/nuggets/css-gradient-borders

-------------------------------- */

/* method 1 -> use border-image */
.btn-gradient-1 {
  border-width: 4px;
  border-style: solid;
  border-image: linear-gradient(to right, darkblue, darkorchid) 1;
}

/* method 2 -> use background-clip to support border-radius */
.btn-gradient-2 {
  background: linear-gradient(white, white) padding-box,
              linear-gradient(to right, darkblue, darkorchid) border-box;
  border-radius: 50em;
  border: 4px solid transparent;
}

/* demo stuff */
.parent {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 3rem;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.btn-gradient-1,
.btn-gradient-2 {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 1em;
  color: darkblue;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

External CSS

  1. https://codepen.io/codyhouse/pen/PoaqJWp.css

External JavaScript

This Pen doesn't use any external JavaScript resources.