← Back to at-rules

CSS At-rule

@position-try

Layout

Defines fallback positioning options for anchor-positioned elements when they overflow their container.

Syntax

@position-try --name { }

Example

@position-try --flip { inset-area: block-end; }

Common use cases

  • Tooltips that flip when near viewport edges
  • Dropdowns that reposition automatically
  • Anchor-positioned UI components

Practical developer insight

@position-try is part of the CSS Anchor Positioning spec — it's cutting-edge and browser support is still limited. Check compatibility before using in production.

Related