Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Style children elements on Tailwind

It looks like Tailwind 3.1 will have support to arbitraty variants which will allow you to style children elements from the parent class.

Example of the famous zebra pattern:

<ul class="[&>*:nth-child(even)]:bg-gray-300">
  <li>Z</li>
  <li>E</li>
  <li>B</li>
  <li>R</li>
  <li>A</li>
</ul>