Skip to content

Instantly share code, notes, and snippets.

@joshrcook
Last active April 29, 2024 15:56
Show Gist options
  • Save joshrcook/f497fe7a677a34060966 to your computer and use it in GitHub Desktop.
Save joshrcook/f497fe7a677a34060966 to your computer and use it in GitHub Desktop.
Rounded Button with Gradient Border
<button>Get Started</button>
https://jsfiddle.net/yb9dto0k/1/
body {
background-color: black;
}
button {
border: none;
display: inline-block;
border-radius: 99px;
color: white;
position: relative;
z-index: 1;
font-size: 14px;
padding: 17px 35px;
font-weight: 100;
text-transform: uppercase;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
letter-spacing: 2px;
}
button:before,
button:after {
content: ' ';
position: absolute;
border-radius: 99px;
}
button:before {
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: -2;
background: #503b9a;
background: -moz-linear-gradient(left, #503b9a 0%, #269cc1 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#503b9a), color-stop(100%,#269cc1));
background: -webkit-linear-gradient(left, #503b9a 0%,#269cc1 100%);
background: -o-linear-gradient(left, #503b9a 0%,#269cc1 100%);
background: -ms-linear-gradient(left, #503b9a 0%,#269cc1 100%);
background: linear-gradient(to right, #503b9a 0%,#269cc1 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#503b9a', endColorstr='#269cc1',GradientType=1 );
}
button:after {
top: 2px;
bottom: 2px;
left: 2px;
right: 2px;
background-color: black;
z-index: -1;
opacity: 1;
transition: all 0.6s ease-in-out;
}
button:hover:after {
opacity: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment