Dev Helpers

Tailwind CSS / Position and stacking

Pin a label to the preview viewport

Dev Helpers · January 9, 2026

Viewport-pinned labels need deliberate offsets and a stacking level. Mobile browser controls can change how much space appears around a fixed label.

Worked example

<div class="demo fixed bottom-4 right-4">
  Pin a label to the preview viewport
</div>

Implementation notes

A fixed badge can be trapped in an ancestor stacking context. A higher local z-index cannot always place it above an unrelated header.

Try it yourself

Rotate a phone and open the on-screen keyboard.

Open the Tailwind CSS example →

Editorial date January 9, 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.