简单!
所有你需要的是一个线性渐变CSS规则。
$(function() {
$("#tabs").tabs();
$('.gradient_me').each(function(index) {
var color = 'rgb(' + (255-index*75) + ', 0, 0)';
var color2 = 'rgb(' + (255-index*75 - 75) + ', 0, 0)';
$(this).css('background', '-moz-linear-gradient(left, '+color+', ' + color2 +')');
$(this).css('background', '-webkit-linear-gradient(left, '+color+', ' + color2 +')');
$(this).css('background', '-ms-linear-gradient(left, '+color+', ' + color2 +')');
$(this).css('background', '-o-linear-gradient(left, '+color+', ' + color2 +')');
$(this).css('background', 'linear-gradient(left, '+color+', ' + color2 +')');
});
});
演示:http://jsfiddle.net/5zfyU/8/
'但问题是一个选项卡只包含一个color.' u能阐述这个..我检查了小提琴和标签头有3种不同的颜色 – bipen 2013-04-29 05:28:24
@ bipen,我想渐变颜色为每个选项卡。在演示中,您可以看到选项卡渐变。但在选项卡内,它不是 – Niths 2013-04-29 05:30:34