CSSPositionTryRule: style-Eigenschaft

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Die schreibgeschützte style-Eigenschaft der CSSPositionTryRule-Schnittstelle gibt ein CSSPositionTryDescriptors-Objekt zurück, das die Deklarationen darstellt, die im Rumpf der @position-try-at-Regel festgelegt sind.

Wert

Beispiele

Das CSS enthält eine @position-try-at-Regel mit dem Namen --custom-right und drei Deskriptoren.

css
@position-try --custom-bottom {
  top: anchor(bottom);
  min-width: 100px;
  margin: 10px 0 0 0;
}
js
const myRules = document.styleSheets[0].cssRules;
const tryOption = myRules[0]; // a CSSPositionTryRule
console.log(tryOption.style.top); // "anchor(bottom)"
console.log(tryOption.style["min-width"]); // "100px"
console.log(tryOption.style.positionArea); // ""; no position-area specified

Spezifikationen

Specification
CSS Anchor Positioning
# dom-csspositiontryrule-style

Browser-Kompatibilität

Siehe auch