How can I put each letter of a word in a color? For example of the word Proud | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I put each letter of a word in a color? For example of the word Proud

7th Nov 2022, 6:57 PM
🌸🌸🌸
🌸🌸🌸 - avatar
3 Answers
+ 2
if you are only using HTML and CSS, you need to wrap each letter in a span tag. HTML: <p> <span class="red">P</span> <span class="yellow">r</span> <span class="green">o</span> <span class="blue">u</span> <span class="purple">d</span> </p> Then specify the colors in CSS: .red { color: red; } etc.... Or you can apply the color directly to the html tag: <span style='color: red'>P</span>
7th Nov 2022, 7:37 PM
Mohamed Ghulam
Mohamed Ghulam - avatar
+ 1
THANK YOU
7th Nov 2022, 8:04 PM
🌸🌸🌸
🌸🌸🌸 - avatar
+ 1
putréfaction But if you want to do it for longer words, javascript is the way to do it. https://code.sololearn.com/WtA1xUc5mCOb/?ref=app
7th Nov 2022, 10:53 PM
Bob_Li
Bob_Li - avatar