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

View in English Always switch to English

CSSPositionTryRule: name プロパティ

Baseline 2026
最近利用可能

January 2026以降、この機能は最新のバージョンの端末およびブラウザーで動作します。古い端末やブラウザーでは動作しないことがあります。

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"

仕様書

仕様書
CSS Anchor Positioning Module Level 1
# dom-csspositiontryrule-name

ブラウザーの互換性

関連情報