css gradient text

CSS Gradient Text in C

To create CSS gradient text in C, you can use the CSS background-clip property along with the text value. Here's an example of how you can achieve this:

#include <stdio.h>

int main() {
    printf("<html>\n");
    printf("<head>\n");
    printf("<style>\n");
    printf("h1 {\n");
    printf("  background: -webkit-linear-gradient(#e66465, #9198e5);\n");
    printf("  -webkit-background-clip: text;\n");
    printf("  -webkit-text-fill-color: transparent;\n");
    printf("}\n");
    printf("</style>\n");
    printf("</head>\n");
    printf("<body>\n");
    printf("<h1>Gradient Text</h1>\n");
    printf("</body>\n");
    printf("</html>\n");

    return 0;
}

In this example, we use the -webkit-linear-gradient property to define the gradient colors. The -webkit-background-clip property with the value text ensures that the gradient is applied only to the text. Finally, the -webkit-text-fill-color property with the value transparent makes the text color transparent, allowing the gradient to show through.

Please note that this example uses the -webkit- prefix, which is specific to WebKit-based browsers like Safari and Chrome. If you want to support other browsers, you may need to use vendor prefixes specific to those browsers as well.

I hope this helps! Let me know if you have any further questions.