Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web-APIs
  3. CSSPositionTryRule

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten.Erfahre mehr über dieses Experiment.

View in EnglishAlways switch to English

CSSPositionTryRule

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.

DasCSSPositionTryRule-Interface beschreibt ein Objekt, das eine@position-tryAt-Regel repräsentiert.

CSSRule CSSPositionTryRule

Instanz-Eigenschaften

Erbt Eigenschaften von seinem VorfahrenCSSRule.

CSSPositionTryRule.nameSchreibgeschützt

Repräsentiert den Namen der Position Try-Option, die durch die@position-try At-Regel's<dashed-ident> angegeben wird.

CSSPositionTryRule.styleSchreibgeschützt

EinCSSPositionTryDescriptors-Objekt, das die Deklarationen darstellt, die im Körper der@position-try At-Regel festgelegt sind.

Instanz-Methoden

Keine spezifischen Methoden; erbt Methoden von seinem VorfahrenCSSRule.

Beispiele

Das CSS enthält eine@position-try At-Regel mit einem Namen von--custom-left und drei Deskriptoren.

css
@position-try --custom-left {  position-area: left;  width: 20%;  max-width: 200px;  margin-right: 10px;}
js
const myRules = document.styleSheets[0].cssRules;const tryOption = myRules[0]; // a CSSPositionTryRuleconsole.log(tryOption); // "[object CSSPositionTryRule]"console.log(tryOption.name); // "--custom-left"console.log(tryOption.style); // "[object CSSPositionTryDescriptors]"console.log(tryOption.style.maxWidth); // "200px"

Spezifikationen

Specification
CSS Anchor Positioning Module Level 1
# csspositiontryrule

Browser-Kompatibilität

Siehe auch

Help improve MDN

Learn how to contribute Diese Seite wurde automatisch aus dem Englischen übersetzt.

[8]ページ先頭

©2009-2026 Movatter.jp