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