Previously, the clip attribute was used to splice up and down two half different colors of text.
Colorful gradient words, compatible with all mainstream browsers.
Only the colorful () function is really useful in page JS:
CopyCode The Code is as follows: function colorful (OBJ, Font, R, G, B, type ){
VaR boxobj;
If (typeof (OBJ) = "string" | typeof (OBJ) = "Number "){
Boxobj = Document. getelementbyid (OBJ );
} Else {
Boxobj = OBJ;
}
Boxobj. innerhtml = "<a href = '#'>" + font + "</a> ";
VaR num = boxobj. getelementsbytagname ("A") [0]. scrollwidth;
Boxobj. innerhtml = "";
For (VAR I = 0; I <= num; I ++ ){
VaR J = I + 1;
VaR c = math. Round (255/num * I );
Switch (number (type )){
Case 0: r = C; G = C; B = C; break;
Case 1: r = C; break;
Case 2: g = C; break;
Case 3: B = C; break;
}
VaR iobj = Document. createelement ("");
Iobj. innerhtml = font;
Iobj. style. Clip = "rect (Auto" + J + "PX auto" + I + "PX )";
Iobj. style. color = "RGB (" + R + "," + G + "," + B + ")";
Iobj. href = "#";
Boxobj. appendchild (iobj );
}
}
Xmlns = "http://www.w3.org/1999/xhtml">
CSS colorful gradient words
|
Text: |
|
R value: |
Initializes the R value in the RGB color. |
G value: |
Initialize the G value in the RGB color. |
B value: |
Initializes the B value in the RGB color. |
Gradient mode: |
Grayscale gradientVariable R ValueChange G valueChange B value The corresponding value is forced to be 0 ~ Change between 255 |
Gradient coloring
Designed by silence. For details, refer to the source.
Http://www.silentash.com /? Id = 109