Top border with gradient using css

you could use an image http://border-image.com/ or use a pseudo element over your border :

.bordertest {
    height:300px;
    width:300px;
    border-top:30px solid #c4268c;
    background:#000;
    position:relative;
    margin:1em;
}
.bordertest:first-child:before {
    content:'';
    position:absolute;
    width:100%;
    height:30px;
    background:linear-gradient(to left, #c4268c, #9a0b72);
    top:-30px;
    left:0;
}

http://jsfiddle.net/aKhjk/1/ - jsfiddle.net/aKhjk/3


Try this, its also cross browser ready. So not so much work for you to do.

http://jsfiddle.net/cornelas/aKhjk/6/

.bordertest {
    height:300px;
    width:300px;
    border-top:30px solid #c4268c;
    /** Created at http://www.colorzilla.com/gradient-editor/ **/
    background: rgb(196,38,140); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(196,38,140,1) 0%, rgba(154,11,114,1) 5%, rgba(0,0,0,1) 10%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(196,38,140,1)), color-stop(5%,rgba(154,11,114,1)), color-stop(10%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c4268c', endColorstr='#000000',GradientType=0 ); /* IE6-9 */

}

Tags:

Css

Xhtml

Border