JSFiddle - React, Tailwind, and code Playground

by sujay

HTML

<div>
    <span> Text</span>
    <p> This is a paragraph. and it works like a paragraph in any book. keeps occupying the container and wraps. Thats all for this paragraph now.
    </p>
    <p> Yet Another Paragraph <span> spanning </span> not more than a line.</p>
</div>

CSS

p {
    margin-left : 5px;
    text-indent: 45px;
}

span {
    color : #f07;
    cursor: pointer;
}

JavaScript

var spans = document.getElementsByTagName('span');
for (var i=0;i<spans.length;i++) {
    spans[i].onclick = function() {
        this.style.color = this.style.color ? '' : '0BF';
        console.log(this, this.style);
    }
}