Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradient borders

Tags:

css

gradient

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?

like image 226
Mark Avatar asked Apr 26 '10 21:04

Mark


People also ask

How do you make a gradient border?

To show gradients for a border with CSS you can use the border-image property. It allows setting gradient values in the same way as the background-image property. Besides the border-image property, you should specify additional properties to actually show border gradient.

Can I use linear gradient in border color?

You can use whatever linear-gradient or repeat-gradient you want. The border-image slice property needs to be 1 for linear gradient.


1 Answers

WebKit now (and Chrome 12 at least) supports gradients as border image:

-webkit-border-image: -webkit-gradient(linear, left top, left bottom, from(#00abeb), to(#fff), color-stop(0.5, #fff), color-stop(0.5, #66cc00)) 21 30 30 21 repeat repeat; 

Prooflink -- http://www.webkit.org/blog/1424/css3-gradients/
Browser support: http://caniuse.com/#search=border-image

like image 77
Tony Avatar answered Oct 08 '22 12:10

Tony