Search code examples
cssbordergradientlinear-gradients

How to do gradient borders in CSS


I'm trying to apply a gradient to a border, I thought it was as simple as doing this:

border-color: -moz-linear-gradient(top, #555555, #111111);

But this does not work.

Does anyone know what is the correct way to do border gradients?


Solution

  • The border-image property can accomplish this. You'll need to specify border-style and border-width too.

    border-image: linear-gradient(#f6b73c, #4d9f0c) 30;
    border-width: 4px;
    border-style: solid;
    

    Read more on MDN.