--- title: slot slug: Web/HTML/Global_attributes/slot translation_of: Web/HTML/Global_attributes/slot ---
{{HTMLSidebar("Global_attributes")}}{{SeeCompatTable}}

slot 全局属性 将一个 shadow DOM shadow 树中的槽分配给一个元素: 带有 slot 属性的元素分配给由 {{HTMLElement("slot")}} 创建的槽,它的 {{htmlattrxref("name", "slot")}} 属性的值匹配 slot 属性的值。

规范

Specification Status Comment
{{SpecName('HTML WHATWG', "dom.html#attr-slot", "slot attribute")}} {{Spec2('HTML WHATWG')}}  
{{SpecName('DOM WHATWG', "#dom-element-slot", "slot attribute")}} {{Spec2('DOM WHATWG')}}  

浏览器兼容性

{{Compat("html.global_attributes.slot")}}

另见