JSFiddle - React, Tailwind, and code Playground

by elneco

HTML

<h1>My Title Sucks</h1>

CSS

h1 span {font-size: 5em; color: grey;}
h1 span:nth-child(2n) {color: blue;}
h1 span:nth-child(4n) {color: lightblue;}

JavaScript

var words = $('h1').text().split("");
    var html = '';

            $.each(words, function(i) {
                html += '<span id="i' + i + '">'+words[i]+'</span>';
            });
 
    $('h1').html(html);