Dev Helpers

Tailwind CSS / Selectors and generated content

Show a placeholder for an empty panel

Dev Helpers · March 29, 2026

An empty-state variant keeps the visual rule next to the component markup. Confirm the element truly has no children before relying on the variant.

Worked example

<div
  class="demo empty:before:content-['No_results'] empty:before:text-slate-600"
></div>

Implementation notes

Whitespace generated by a template can keep an otherwise blank element from matching the empty state. Prefer an explicit state attribute when business state drives the message.

Try it yourself

Insert a space or a hidden child and inspect the result.

Open the Tailwind CSS example →

Editorial date March 29, 2026 · Published December 6, 2026

Related articles

Selection background swatch

The selection variant lets a component specify its own selected-text colours. Readability depends on the selected foreground as well as the highlight.

Skew a label

A skew utility changes the painted shape without allocating extra room for the slanted edge. A separate inner wrapper can keep lettering upright.

Horizontal flex row

Flex utilities define the row but children can still resist shrinking. Inspect long labels before adding more breakpoints.