CSSPositionTryRule: style-Eigenschaft
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Die style schreibgeschützte Eigenschaft der CSSPositionTryRule-Schnittstelle gibt ein CSSPositionTryDescriptors-Objekt zurück, das die in der Hauptdeklaration der @position-try-At-Regel gesetzten Deklarationen darstellt.
Wert
Ein CSSPositionTryDescriptors-Objekt.
Beispiele
Das CSS enthält eine @position-try-At-Regel mit einem Namen --custom-right und drei Deskriptoren.
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]; // 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> |