CSSPositionTryRule: name-Eigenschaft
Baseline
2026
Newly available
Since January 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Die name-Eigenschaft der CSSPositionTryRule-Schnittstelle ist schreibgeschützt und repräsentiert den Namen der Zurückfaller-Option für die Position, die durch die @position-try-Regel mit <dashed-ident> spezifiziert wird.
Wert
Ein String.
Beispiele
Das CSS enthält eine @position-try-Regel mit einem Namen --custom-bottom und drei Deskriptoren.
css
@position-try --custom-bottom {
top: anchor(bottom);
min-width: 100px;
margin-top: 10px;
}
js
const myRules = document.styleSheets[0].cssRules;
const tryOption = myRules[0]; // a CSSPositionTryRule
console.log(tryOption.name); // "--custom-bottom"
Spezifikationen
| Specification |
|---|
| CSS Anchor Positioning Module Level 1> # dom-csspositiontryrule-name> |