7

I am trying to make right border of an <ul> element to be linear gradient.
I have tried following but with no success:

-webkit-border-image: -webkit-linear-gradient(top, #FE2EF7, #4AC0F2) 0 0 5px;

I am using Chrome.
Many thanks

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
daniel.tosaba
  • 2,503
  • 9
  • 36
  • 47

3 Answers3

6

There is a solution for that but I'm not sure you can adjust the border width: http://jsfiddle.net/u2ZE4/1/

-webkit-border-image: -webkit-gradient(linear, left top, left bottom, from(#e00), to(#fff))0 100% 0 0 stretch;
Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
  • this is perfect. you can even adjust border width by simply defining `border-width` property. thank you for being persistent :) greets from bosnia!! – daniel.tosaba Aug 13 '11 at 12:29
  • Can you post code here instead of just on jsfiddle? I don't know if they host your solutions forever, but if that page ever goes down, this answer becomes worthless. – Bill the Lizard Aug 13 '11 at 13:07
1

If anybody is interested, this is how I applied a right border gradient on a div where the top and bottom ends fade out. Seems like it took forever to figure out... This is only for Safari as doing the same thing in Firefox is a lot easier...

http://jsfiddle.net/fkFec/1102/

<div class="g">
   <div>bla</div>
</div> 

.g {
    border-right-width:1px;
    -webkit-border-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(0, transparent), color-stop(0.5, grey), color-stop(0.5, grey), color-stop(1, transparent)) 0 100%;
    border-right-width: 1px;
    border-left-width: 0px;
    border-top-width: 0px;
    border-bottom-width: 0px;
    padding: 2px;
    width: 400px;
    height: 150px;
    margin: 10px auto;
}
Dana Harris
  • 387
  • 3
  • 6
0

Both above options were not working for me, but the following code worked:

For right border:

.right-gradient-bdr{
    border-width: 1px;
    border-style: solid;
    border-left:0;
    border-image: 
    linear-gradient(rgba(0,0,0,0), rgba(0,0,0,1), rgba(0,0,0,0)) 0 100%;
}

For bottom border:

.bottom-gradient-bdr{
    border: 0px;
    border-bottom: 1px solid;
    border-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
    border-image-slice: 1;
}
Gaurav
  • 1,214
  • 2
  • 17
  • 32