On this page
Pseudo-Elements
Prev: Pseudo-Classes | Up: selectors | Next: properties
Rel: Interactive & Scripting, Shadow DOM & Web Components
Ref: MDN Web Docs โ Pseudo-elements
Tags: #public #web #css #selectors
Contents
Generated Content (::before & ::after)
::before and ::after insert virtual child boxes inside an element (requires content). Provide empty alt text (content: "โ
" / "") when the generated glyph is purely decorative so screen readers skip it.
.external-link::after {
content: " โ" / "";
font-size: 0.85em;
}
Top-Layer & Component Pseudo-Elements
::backdrop: Styles the dimmed layer behind<dialog>(showModal()) orpopoverelements.::placeholder: Styles placeholder text inside<input>and<textarea>.::part(name): Styles explicitly exportedpart="name"elements inside a Web Component's Shadow DOM.::slotted(selector): Styles light-DOM elements projected into a Shadow DOM<slot>.
dialog::backdrop {
background: rgb(0 0 0 / 0.55);
backdrop-filter: blur(2px);
}
Linked from
Related notes
- tuts/css/selectors Linked here; links to this page; shared tags: #css, #selectors, #web
- tuts/css/selectors/pseudo_classes Linked here; links to this page; shared tags: #css, #selectors, #web
- tuts/html/elements/interactive_and_scripting Linked here; links to this page; shared tags: #web
- tuts/web/dom/shadow_dom_and_web_components Linked here; links to this page; shared tags: #web
- tuts/css/properties Linked here; shared tags: #css, #web
- tuts/web/tutorials/vanilla_interactive_components links to this page; shared tags: #web
- tuts/css/selectors/basic_and_combinator_selectors shared tags: #css, #selectors, #web
- tuts/css shared tags: #css, #web
- tuts/css/at_rules shared tags: #css, #web
- tuts/css/at_rules/keyframes_and_fonts shared tags: #css, #web