By Rakesh Sivaraman


2020-02-14 08:03:39 8 Comments

How can I get this output in CSS or jQuery.

::first-letter or CSS is (equal to) === "Some Value e.g. ' (1)(a)(I)(2)'" to get output background-color:red;

Sample HTML:

<p>(1)</p>
<p>(a)</p>
<p>(b)</p>
<p>(2)</p>
<p>(a)</p>
<p>(i)</p>
<p>(ii)</p>
<p>(iii)</p>

Output should be:

<p>(1)</p> <--Background-color RED
<p>(a)</p> <--Background-color GREEN
<p>(b)</p> <--Background-color GREEN
<p>(2)</p> <--Background-color RED
<p>(a)</p> <--Background-color GREEN
<p>(i)</p> <--Background-color YELLOw
<p>(ii)</p> <--Background-color YELLOw
<p>(iii)</p> <--Background-color YELLOw

Related Questions

Sponsored Content

Sponsored Content