@zuolizhu
Posted
Hey Sagar,
Good work on this solution!
border-color
does not allow you to use gradient color, instead, you can use border-image
😎. e.g. border-image: linear-gradient(45deg, hsl(37, 97%, 70%) ,hsl(329, 70%, 58%)) 1;
Check out this documentation for more details: https://developer.mozilla.org/en-US/docs/Web/CSS/border-image
Me personally prefer use ::before
or ::after
for those small design elements (arrows, borders, icons etc, you don't have to think about the border
as a border 🤯).
A gradient border would be something like this:
.card::before {
width: 100%;
height: 4px;
background: linear-gradient(45deg, hsl(37, 97%, 70%) ,hsl(329, 70%, 58%));
}
Hope this helped.
Happy coding 😆
@sagarkaurav
Posted
@zuolizhu Thanks for showing me new CSS tricks but could not able to make it work with your example. I used an example from https://css-tricks.com/gradient-borders-in-css/. I am using a wrapper div with background color and giving top padding to make it look like border.