CSSPositionTryRule: thuộc tính 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.

Thuộc tính chỉ đọc name của giao diện CSSPositionTryRule biểu thị tên của tùy chọn dự phòng position try được chỉ định bởi <dashed-ident> của at-rule @position-try.

Giá trị

Một chuỗi.

Ví dụ

CSS bao gồm at-rule @position-try với tên --custom-bottom và ba descriptor.

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.name); // "--custom-bottom"

Thông số kỹ thuật

Thông số kỹ thuật
CSS Anchor Positioning Module Level 1
# dom-csspositiontryrule-name

Tương thích trình duyệt

Xem thêm