@position-try is a CSS at-rule that defines a named fallback layout for an anchor-positioned element. Defining an option is only half the job: you must also list its name on the element with position-try-fallbacks or the position-try shorthand.
What @position-try does
Anchor positioning lets an element be placed relative to another element, called its anchor. If the positioned element would overflow its inset-modified containing block or the viewport, the browser can try alternative placements. @position-try gives you a way to define a named custom alternative, including changes to placement, spacing, sizing, or alignment.
The at-rule has this form:
@position-try --try-option-name {
/* supported descriptors */
}
The name is a dashed identifier, such as --custom-bottom. The rule defines the option; it does not apply it automatically. The anchor-positioned element must refer to that name.
Define an option and connect it to an element
This example defines a below-anchor alternative for a fixed infobox and asks the browser to prefer the fallback that provides the most height:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
@position-try --custom-bottom {
top: anchor(bottom);
bottom: unset;
margin-top: 10px;
}
.infobox {
position: fixed;
position-anchor: --my-anchor;
bottom: anchor(top);
margin-bottom: 10px;
justify-self: anchor-center;
position-try: most-height --custom-bottom;
}
The custom option changes the element’s placement to below the anchor and sets a top margin. The position-try shorthand connects the option to the infobox and sets its fallback ordering preference. This is a documented usage pattern, not a guarantee that this exact layout fits every page or viewport.
What you can change in a custom option
A @position-try rule can contain descriptors for position area or inset values, margins, sizing, and self-alignment. When the browser applies the option, its declared values take precedence over corresponding standard property values on the element. This lets a fallback change more than just which side of the anchor the element occupies.
Rank #2
How the browser chooses a fallback
The element’s fallback names are candidates, not simultaneous styles. The browser tries the alternatives when the positioned element would overflow its relevant containing block or the viewport, and uses an option that avoids overflow when one fits.
- Candidate choice: use named custom options such as those declared with
@position-try, or built-in position-area and try-tactic options where appropriate. - Ordering: with the default
normalorder, the browser tests alternatives in the order listed. A try-size preference such asmost-heightcan prioritize the option that yields more height. - Layout effect: each option can change placement and may also change spacing, sizing, or alignment. Choose alternatives that make sense for the content and available space.
For details on the shorthand and ordering behavior, see MDN’s position-try property reference.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Rank #3
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Browser support
MDN marks @position-try Baseline 2026 and says it has been available across the latest devices and browser versions since January 2026. That broad status does not mean every older browser or device supports it. Check a current compatibility table against the browser versions your site needs to support before relying on the feature in production. MDN’s @position-try reference documents the syntax, descriptors, example, and status.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

