CSSPositionTryRule: name プロパティ
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.
name は CSSPositionTryRule インターフェイスの読み取り専用プロパティで、@position-try アットルールの <dashed-ident> で定義された位置試行代替オプションの名前を表します。
値
文字列です。
例
この CSS には、@position-try アットルールがあり、これには --custom-left という名前がついており、3 つの記述子があります。
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]; // CSSPositionTryRule
console.log(tryOption.name); // "--custom-bottom"
仕様書
| Specification |
|---|
| CSS Anchor Positioning Module Level 1> # dom-csspositiontryrule-name> |