Can I apply webkit-gradient to a border or just ba

2019-03-19 09:21发布

So I would like to make the border faded. I have the exact webkit-gradient settings that I want.

But not sure how to implement it on the border element.

Is it possible? How do I do that?

Only CSS3 please.

Btw, I tried the following CSS and it didn't work:

border-color: -webkit-gradient( linear, left bottom, left top, color-stop(0.74, rgb(214,11,11)), color-stop(0.39, rgb(175,13,13)), color-stop(0.07, rgb(157,22,22)));
    border-style: solid;
    border-width: 10px;

标签: html css3
3条回答
手持菜刀,她持情操
2楼-- · 2019-03-19 09:59

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;
}
查看更多
男人必须洒脱
4楼-- · 2019-03-19 10:03

Yes, you can apply -webkit-gradient to a border:

-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;

(from this example on webkit.org)

See the blog post on Webkit.org about -webkit-gradient

查看更多
登录 后发表回答