Skip to content

Instantly share code, notes, and snippets.

@niranyousuf
Last active April 6, 2023 08:04
Show Gist options
  • Save niranyousuf/0a3a78bed876753972c10366b8ece8d1 to your computer and use it in GitHub Desktop.
Save niranyousuf/0a3a78bed876753972c10366b8ece8d1 to your computer and use it in GitHub Desktop.
Border gradient color with transparent background and border-radius
.class_name {
border: 0.094rem solid transparent;
border-radius: 20px;
position: relative;
padding-top: 30px;
padding-bottom: 20px;
&::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(180deg, #8486a7, transparent) border-box;
border: inherit;
border-radius: inherit;
mask: linear-gradient(#fff, #fff) padding-box, linear-gradient(#fff, #fff);
mask-composite: exclude;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment