web api interface
CSSPositionTryDescriptors
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
CSSPositionTryRuleinterface represents a@position-tryat-rule, and thestyleproperty is an instance of this object.
Instance properties
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-selforalignSelf- : A string representing the value of an
align-selfdescriptor.
- : A string representing the value of an
block-sizeorblockSize- : A string representing the value of a
block-sizedescriptor.
- : A string representing the value of a
bottom- : A string representing the value of a
bottomdescriptor.
- : A string representing the value of a
height- : A string representing the value of a
heightdescriptor.
- : A string representing the value of a
inline-sizeorinlineSize- : A string representing the value of an
inline-sizedescriptor.
- : A string representing the value of an
inset- : A string representing the value of an
insetdescriptor.
- : A string representing the value of an
position-areaorpositionArea- : A string representing the value of a
position-areadescriptor.
- : A string representing the value of a
inset-blockorinsetBlock- : A string representing the value of an
inset-blockdescriptor.
- : A string representing the value of an
inset-block-endorinsetBlockEnd- : A string representing the value of an
inset-block-enddescriptor.
- : A string representing the value of an
inset-block-startorinsetBlockStart- : A string representing the value of an
inset-block-startdescriptor.
- : A string representing the value of an
inset-inlineorinsetInline- : A string representing the value of an
inset-inlinedescriptor.
- : A string representing the value of an
inset-inline-endorinsetInlineEnd- : A string representing the value of an
inset-inline-enddescriptor.
- : A string representing the value of an
inset-inline-startorinsetInlineStart- : A string representing the value of an
inset-inline-startdescriptor.
- : A string representing the value of an
justify-selforjustifySelf- : A string representing the value of a
justify-selfdescriptor.
- : A string representing the value of a
left- : A string representing the value of a
leftdescriptor.
- : A string representing the value of a
margin- : A string representing the value of a
margindescriptor.
- : A string representing the value of a
margin-blockormarginBlock- : A string representing the value of a
margin-blockdescriptor.
- : A string representing the value of a
margin-block-endormarginBlockEnd- : A string representing the value of a
margin-block-enddescriptor.
- : A string representing the value of a
margin-block-startormarginBlockStart- : A string representing the value of a
margin-block-startdescriptor.
- : A string representing the value of a
margin-bottomormarginBottom- : A string representing the value of a
margin-bottomdescriptor.
- : A string representing the value of a
margin-inlineormarginInline- : A string representing the value of a
margin-inlinedescriptor.
- : A string representing the value of a
margin-inline-endormarginInlineEnd- : A string representing the value of a
margin-inline-enddescriptor.
- : A string representing the value of a
margin-inline-startormarginInlineStart- : A string representing the value of a
margin-inline-startdescriptor.
- : A string representing the value of a
margin-leftormarginLeft- : A string representing the value of a
margin-leftdescriptor.
- : A string representing the value of a
margin-rightormarginRight- : A string representing the value of a
margin-rightdescriptor.
- : A string representing the value of a
margin-topormarginTop- : A string representing the value of a
margin-topdescriptor.
- : A string representing the value of a
max-block-sizeormaxBlockSize- : A string representing the value of a
max-block-sizedescriptor.
- : A string representing the value of a
max-heightormaxHeight- : A string representing the value of a
max-heightdescriptor.
- : A string representing the value of a
max-inline-sizeormaxInlineSize- : A string representing the value of a
max-inline-sizedescriptor.
- : A string representing the value of a
max-widthormaxWidth- : A string representing the value of a
max-widthdescriptor.
- : A string representing the value of a
min-block-sizeorminBlockSize- : A string representing the value of a
min-block-sizedescriptor.
- : A string representing the value of a
min-heightorminHeight- : A string representing the value of a
min-heightdescriptor.
- : A string representing the value of a
min-inline-sizeorminInlineSize- : A string representing the value of a
min-inline-sizedescriptor.
- : A string representing the value of a
min-widthorminWidth- : A string representing the value of a
min-widthdescriptor.
- : A string representing the value of a
place-selforplaceSelf- : A string representing the value of a
place-selfdescriptor.
- : A string representing the value of a
position-anchororpositionAnchor- : A string representing the value of a
position-anchordescriptor.
- : A string representing the value of a
right- : A string representing the value of a
rightdescriptor.
- : A string representing the value of a
top- : A string representing the value of a
topdescriptor.
- : A string representing the value of a
width- : A string representing the value of a
widthdescriptor.
- : A string representing the value of a
Instance methods
No specific methods; inherits methods from its ancestor CSSStyleDeclaration.
Examples
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"