+ 1
How to color eache character of a text?
I wanted to color each character of an <h1> with random colors but I don't know how to assign those colors to the <h1> tag.
6 Réponses
+ 6
Use span to enclose each character
https://code.sololearn.com/WwLpwJetzg3f/?ref=app
+ 3
You can try first, and check with this (rendering the letters with JavaScript) :
https://code.sololearn.com/WM0bz2TRKJOr/?ref=app
+ 3
And also, this (adding random color to each letter by JavaScript) :
https://code.sololearn.com/WNphMYDZnoEJ/?ref=app
+ 2
You'll need to use createElement() and appendChild()
https://code.sololearn.com/W0dEL7sP29qH/?ref=app
+ 1
Gordon thank you again! I learned so if I implement this on a JavaScript I would use a for loop in the text of the title and use span tag in each character of it, right?
+ 1
Gordon ok, thank you!