Copyright 2025

The Valley of Code

A Flavio Copes project

Show-hide an element based on existence of a parent class in Tailwind
Show-hide an element based on existence of a parent class in Tailwind

Little relatively unknown Tailwind trick using group:

<div class="group is-published">
  <div class="hidden group-[.is-published]:block">
    Show only when parent has class "is-published"
  </div>
</div>

Join my AI Workshop !

The Web Development BOOTCAMP cohort starts in February 2026