2010-09-29 7 views
8

Je voudrais donc faire disparaître la bordure. J'ai les paramètres de gradient webkit exact que je veux.Puis-je appliquer webkit-gradient à une bordure ou simplement à un arrière-plan?

Mais vous ne savez pas comment l'implémenter sur l'élément border.

Est-ce possible? Comment je fais ça?

Seulement CSS3 s'il vous plaît.

BTW, j'ai essayé le CSS suivant et il ne fonctionne pas:

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; 

Répondre

12

Oui, vous pouvez appliquer -webkit-gradient à une frontière:

-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

+2

Cela ne fonctionne pas avec rayon de frontière =/ – grisevg

+0

@Josh Border Les dégradés d'image sont TRÈS TRÈS TRÈS brisés, mais si vous voulez risquer, vous POUVEZ pirater quelque chose ensemble (ça ne marchera pas très bien si vous changez les niveaux de zoom ou sur tel ou tel navigateur) http://jsfiddle.net/MWaTw/ [testé dans google chrome] – mrBorna

0

Si quelqu'un est intéressé, voici comment j'ai appliqué un dégradé de bordure droite sur un div où les extrémités supérieure et inférieure disparaissent. On dirait qu'il a fallu une éternité pour comprendre ... C'est seulement pour Safari faire la même chose dans Firefox est beaucoup plus facile ...

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