Today, I wanted to show you how you can use gradients for borders in CSS—something that historically required faux borders and background colors, but is now supported natively. Let's dig in! The border at the top of the pageMy website typically has a gray border at the top…
But for Pride Month, I decided to swap it out with the Progress Pride Flag colors this year. In years past, this effect has required hiding the border, and then adding a
Here, I'm defining a Then, I define each of the 10 colors in the flag. The numbers after each color are stops. They define where the color should start and stop along the gradient. By having each color start where the previous one left off, I end up with hard lines and no colors bleeding together. If I omit the percentages, the colors blend together evenly across the gradient.
Here's a demo with both examples. Using gradients for bordersWith modern CSS, you can now apply gradients to borders using the Going back to my default border…
I can take the This is a shorthand property, and also requires a
Like this? A Go Make Things membership is the best way to support my work and help me create more free content. Cheers, Want to share this with others or read it later? View it in a browser. |
0 Komentar untuk "[Go Make Things] Gradient borders with CSS"