このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

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.

nameCSSPositionTryRule インターフェイスの読み取り専用プロパティで、@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

ブラウザーの互換性

関連情報