JSFiddle - React, Tailwind, and code Playground

by Amin Shah Gilani

HTML

<div class="black box">
  <div data-color="green">
    This text should be green
  </div>

  <div data-color="red">
    This text should be red
  </div>

  <div data-color="white">
    This text should be white
  </div>
</div>

CSS

/* Ignore this */
.black.box {
  background-color: black;
}


/* Refactor the three rules below into a single rule */
div[data-color="green"] {
  color: green;
}

div[data-color="red"] {
  color: red;
}

div[data-color="white"] {
  color: white;
}