CSSPositionTryRule: name 属性
CSSPositionTryRule 接口的只读属性 name 代表了由 @position-try at-rule 的 <dashed-ident> 指定的位置尝试备选项的名称。
值
字符串。
示例
CSS 包含一个名为 --custom-bottom 且具有三个描述符的 @position-try at-rule。
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"
规范
| 规范 |
|---|
| CSS 锚点定位 # dom-csspositiontryrule-name |
浏览器兼容性
加载中…