This feature is not Baseline because it does not work in some of the most widely-used browsers.
The CSSPositionTryDescriptors interface defines properties that represent the list of CSS descriptors that can be set in the body of a @position-try at-rule.
Each descriptor in the body of the corresponding @position-try at-rule can be accessed using either its property name in bracket notation or the camel-case version of the property name "propertyName" in dot notation. For example, you can access the CSS property "property-name" as style["property-name"] or style.propertyName, where style is a CSSPositionTryDescriptors instance. A property with a single-word name like height can be accessed using either notation: style["height"] or style.height.
Note: The CSSPositionTryRule interface represents a @position-try at-rule, and the CSSPositionTryRule.style property is an instance of this object.
Inherits properties from its ancestor CSSStyleDeclaration.
The following property names, in snake-case (accessed using bracket notation) and camel-case (accessed using dot notation), each represent the value of a descriptor in the corresponding @position-try at-rule:
align-self or alignSelfA string representing the value of an align-self descriptor.
block-size or blockSizeA string representing the value of a block-size descriptor.
bottomA string representing the value of a bottom descriptor.
heightA string representing the value of a height descriptor.
inline-size or inlineSizeA string representing the value of an inline-size descriptor.
insetA string representing the value of an inset descriptor.
position-area or positionAreaA string representing the value of a position-area descriptor.
inset-block or insetBlockA string representing the value of an inset-block descriptor.
inset-block-end or insetBlockEndA string representing the value of an inset-block-end descriptor.
inset-block-start or insetBlockStartA string representing the value of an inset-block-start descriptor.
inset-inline or insetInlineA string representing the value of an inset-inline descriptor.
inset-inline-end or insetInlineEndA string representing the value of an inset-inline-end descriptor.
inset-inline-start or insetInlineStartA string representing the value of an inset-inline-start descriptor.
justify-self or justifySelfA string representing the value of a justify-self descriptor.
leftA string representing the value of a left descriptor.
marginA string representing the value of a margin descriptor.
margin-block or marginBlockA string representing the value of a margin-block descriptor.
margin-block-end or marginBlockEndA string representing the value of a margin-block-end descriptor.
margin-block-start or marginBlockStartA string representing the value of a margin-block-start descriptor.
margin-bottom or marginBottomA string representing the value of a margin-bottom descriptor.
margin-inline or marginInlineA string representing the value of a margin-inline descriptor.
margin-inline-end or marginInlineEndA string representing the value of a margin-inline-end descriptor.
margin-inline-start or marginInlineStartA string representing the value of a margin-inline-start descriptor.
margin-left or marginLeftA string representing the value of a margin-left descriptor.
margin-right or marginRightA string representing the value of a margin-right descriptor.
margin-top or marginTopA string representing the value of a margin-top descriptor.
max-block-size or maxBlockSizeA string representing the value of a max-block-size descriptor.
max-height or maxHeightA string representing the value of a max-height descriptor.
max-inline-size or maxInlineSizeA string representing the value of a max-inline-size descriptor.
max-width or maxWidthA string representing the value of a max-width descriptor.
min-block-size or minBlockSizeA string representing the value of a min-block-size descriptor.
min-height or minHeightA string representing the value of a min-height descriptor.
min-inline-size or minInlineSizeA string representing the value of a min-inline-size descriptor.
min-width or minWidthA string representing the value of a min-width descriptor.
place-self or placeSelfA string representing the value of a place-self descriptor.
position-anchor or positionAnchorA string representing the value of a position-anchor descriptor.
rightA string representing the value of a right descriptor.
topA string representing the value of a top descriptor.
widthA string representing the value of a width descriptor.
No specific methods; inherits methods from its ancestor CSSStyleDeclaration.
The CSS includes a @position-try at-rule with a name of --custom-right and three descriptors.
@position-try --custom-right {
position-area: right;
width: 100px;
margin-left: 10px;
}
const myRules = document.styleSheets[0].cssRules; const tryOption = myRules[0]; // a CSSPositionTryRule console.log(tryOption.style); // "[object CSSPositionTryDescriptors]" console.log(tryOption.style.margin); // "0 0 0 10px" console.log(tryOption.style["position-area"]); // "right"
| Specification |
|---|
| CSS Anchor Positioning> # csspositiontrydescriptors> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
CSSPositionTryDescriptors |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
align-self |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
alignSelf |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
block-size |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
blockSize |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
bottom |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
height |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inline-size |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inlineSize |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset-block |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset-block-end |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset-block-start |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset-inline |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset-inline-end |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
inset-inline-start |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
insetBlock |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
insetBlockEnd |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
insetBlockStart |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
insetInline |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
insetInlineEnd |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
insetInlineStart |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
justify-self |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
justifySelf |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
left |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-block |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-block-end |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-block-start |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-bottom |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-inline |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-inline-end |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-inline-start |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-left |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-right |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
margin-top |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginBlock |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginBlockEnd |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginBlockStart |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginBottom |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginInline |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginInlineEnd |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginInlineStart |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginLeft |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginRight |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
marginTop |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
max-block-size |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
max-height |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
max-inline-size |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
max-width |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
maxBlockSize |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
maxHeight |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
maxInlineSize |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
maxWidth |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
min-block-size |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
min-height |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
min-inline-size |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
min-width |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
minBlockSize |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
minHeight |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
minInlineSize |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
minWidth |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
place-self |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
placeSelf |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
position-anchor |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
position-area |
129125 | 129125 | 131 | 115111 | 26 | 129125 | No | 8683 | 26 | 28.027.0 | 129125 | 26 |
positionAnchor |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
positionArea |
129125 | 129125 | 131 | 115111 | 26 | 129125 | No | 8683 | 26 | 28.027.0 | 129125 | 26 |
right |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
top |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
width |
125 | 125 | 131 | 111 | 26 | 125 | No | 83 | 26 | 27.0 | 125 | 26 |
CSSPositionTryRule@position-tryposition-try-fallbacks
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSSPositionTryDescriptors