Favorites

CSS position-try-fallbacks Property

position-try-fallbacks
CSS PropertyThis property is supported by all modern browsers.
Updated 22nd November 2026

The position-try-fallbacks property lists the fallback positions an anchor-positioned element tries when it would overflow, such as flip-block.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The position-try-fallbacks property gives an anchor-positioned element a list of alternative positions to use when its default position would overflow its containing block. The browser tries each option in turn and uses the first one that fits; if none fits it keeps the original position.

Each option can be a try-tactic, which transforms the element's current position: flip-block mirrors it across the anchor on the block axis (below becomes above), flip-inline mirrors it on the inline axis, and flip-start swaps the axes. Tactics can be combined, as in flip-block flip-inline. An option can also be a position-area value such as left, or the name of an @position-try rule that sets a whole new group of position properties.

.menu {
  position-area: bottom span-right;
  position-try-fallbacks: flip-block, flip-inline, --as-sheet;
}

This property was first shipped under the name position-try-options. Use position-try-order to prefer the option that gives the most space instead of the first one that fits.

Definition

Initial value
none
Applies to
absolutely positioned elements
Inherited
no
Computed value
as specified
Animatable
discrete
JavaScript syntax
object.style.positionTryFallbacks

Interactive Demo

Anchor
A wide tooltip that does not fit
Demo Code
HTML Code
<div class="demo-area">
	<div class="demo-anchor demo-d">Anchor</div>
	<div class="demo-element">A wide tooltip that does not fit</div>
</div>
CSS Code
.demo-area {
	position: relative;
	width: 300px;
	height: 190px;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
}
.demo-anchor {
	position: absolute;
	padding: 8px 12px;
	background: #e7ecff;
	border: 2px solid #4361ee;
	font-size: 14px;
}

.demo-area {
	overflow: hidden;
}
.demo-d {
	right: 30px;
	top: 70px;
	anchor-name: --demo-d;
}
@position-try --demo-below {
	position-area: bottom;
}
.demo-element {
	position: absolute;
	margin: 4px;
	padding: 4px 8px;
	background: #f72585;
	color: #fff;
	font-size: 13px;
	white-space: nowrap;
	position-anchor: --demo-d;
	position-area: right;
	position-try-fallbacks: none;
}

Syntax

position-try-fallbacks: none | [ [ <dashed-ident> || <try-tactic> ] | <position-area> ]#;

Values

  • noneThe default. No fallback options; the element stays in its default position even if it overflows.
  • flip-blockTry the position mirrored across the anchor on the block axis (for example above instead of below).
  • flip-inlineTry the position mirrored across the anchor on the inline axis (for example left instead of right).
  • flip-startTry the position mirrored across the diagonal from start to end, swapping the inline and block positions.
  • <dashed-ident>The name of an @position-try rule whose declarations replace the element's position properties for that option. It can be combined with try-tactics.
  • <position-area>A position-area value to try, equivalent to an @position-try rule that only sets position-area.
  • initialSets the property to its initial value.
  • inheritTakes the computed value of the parent element.

Example

<div class="stage">
<button class="anchor">Anchor</button>
<div class="tip">Positioned against the button</div>
</div>
.stage {
  height: 160px;
  overflow: auto;
  border: 1px dashed #bbb;
  font-family: system-ui, sans-serif;
}

.anchor {
  anchor-name: --btn;
  margin: 110px 0 300px 60px;
  padding: 10px 18px;
  font: inherit;
}

.tip {
  position: absolute;
  position-anchor: --btn;
  position-area: bottom;
  /* when there is no room below, try above, then to the right */
  position-try-fallbacks: flip-block, right;
  padding: 6px 10px;
  background: #f72585;
  color: #fff;
  border-radius: 6px;
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS position-try-fallbacks property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee