:has-slotted {
/* ... */
}
Examples
This example has two <slot>
elements, one of which has been assigned some content and the other has not.
<p>
<template shadowrootmode="open">
<style>
:has-slotted {
color: rebeccapurple;
}
</style>
<slot name="one">Placeholder 1</slot>
<slot name="two">Placeholder 2</slot>
</template>
<span slot="one">Slotted content</span>
</p>
Result
The <slot>
element that has been assigned content matched the :has-slotted
pseudo-class and has the color
value of rebeccapurple
applied.
Loadingâ¦
See also<template>
element<slot>
element::slotted
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5