slot
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Das slot
Globale Attribut weist einem Element einen Slot in einem Shadow DOM Shadow-Baum zu: Ein Element mit einem slot
-Attribut wird dem Slot zugeordnet, der durch das <slot>
-Element erstellt wurde, dessen name
-Attribut dem Wert dieses slot
-Attributs entspricht. Sie können mehrere Elemente demselben Slot zuordnen, indem Sie denselben Slotnamen verwenden. Elemente ohne slot
-Attribut werden dem unbenannten Slot zugewiesen, falls einer existiert.
Für Beispiele siehe unseren Verwendung von Vorlagen und Slots Leitfaden.
Spezifikationen
Specification |
---|
HTML # attr-slot |
DOM # ref-for-dom-element-slot① |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
slot |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
Siehe auch
- HTML Globale Attribute
- HTML
<slot>
-Element - HTML
<template>
-Element - CSS
::slotted
Pseudo-Element - CSS Scoping Modul
- Webkomponenten