---
id: css-content-pseudo-elements
title: "CSS Content Pseudo-elements"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["::before", "::after", "::marker", "::selection", "::backdrop", "content pseudo-elements", "generated content"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.87
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["css", "web", "frontend", "w3schools", "pseudo-elements", "content"]
raw_sources: ["https://www.w3schools.com/css/css_pseudo_elements_content.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Content Pseudo-elements]]
## π― ν μ€ ν΅μ°° (One-line insight)
Content pseudo-elements insert or style generated parts of an element β `::before`/`::after` add content, while `::marker`, `::selection`, and `::backdrop` style list markers, selected text, and dialog backdrops. [S1]
## π§ ν΅μ¬ κ°λ
(Core concepts)
- **`::before`** β inserts some content before the content of a specified element, via the `content` property. [S1]
- **`::after`** β inserts some content after the content of a specified element, via the `content` property. [S1]
- **`::marker`** β styles the list item markers. [S1]
- **`::selection`** β styles the part of a text that is selected by a user. [S1]
- **`::backdrop`** β styles the viewbox behind a dialog box or popover element. [S1]
## π§© μΆμΆλ ν¨ν΄ (Extracted patterns)
- **Generated content** β `::before`/`::after` paired with the `content` property inject images or text that are not in the HTML. [S1]
- **Marker styling** β `::marker` recolors and resizes list bullets/numbers without changing list structure. [S1]
- **User-state styling** β `::selection` reacts to the user's text selection. [S1]
## π μΈλΆ λ΄μ© (Details)
**The `::before` pseudo-element** [S1]
The `::before` pseudo-element is used to insert some content before the content of a specified element. Here it inserts an image before each `
`:
```css
h3::before {
content: url(smiley.gif);
}
```
**The `::after` pseudo-element** [S1]
The `::after` pseudo-element is used to insert some content after the content of a specified element:
```css
h3::after {
content: url(smiley.gif);
}
```
**The `::marker` pseudo-element** [S1]
The `::marker` pseudo-element is used to style the list item markers:
```css
::marker {
color: red;
font-size: 23px;
}
```
**The `::selection` pseudo-element** [S1]
The `::selection` pseudo-element is used to style the part of a text that is selected by a user:
```css
::selection {
color: red;
background: yellow;
}
```
**The `::backdrop` pseudo-element** [S1]
The `::backdrop` pseudo-element is used to style the viewbox behind a dialog box or popover element:
```css
dialog::backdrop {
background-color: lightgreen;
}
```
## π οΈ μ μ© μ¬λ‘ (Applied in summary)
The page's applied examples are the smiley image inserted before/after ``, recolored/enlarged list markers, red-on-yellow text selection, and a light-green dialog backdrop. No external project/commit applications found in the source.
## π» μ½λ ν¨ν΄ (Code patterns)
Insert content before an element (language: CSS):
```css
h3::before {
content: url(smiley.gif);
}
```
Style user-selected text (language: CSS):
```css
::selection {
color: red;
background: yellow;
}
```
## βοΈ λͺ¨μ λ° μ
λ°μ΄νΈ (Contradictions & updates)
No contradictions found in the source.
## β
κ²μ¦ μν λ° μ λ’°λ
- **μν:** draft
- **κ²μ¦ λ¨κ³:** conceptual (μ€μ μ μ© μ¬λ‘ λ°κ²¬ μ applied/validatedλ‘ μΉκ²© κ°λ₯)
- **μΆμ² μ λ’°λ:** B (W3Schools β widely used educational reference, not a primary standards body)
- **μ λ’° μ μ:** 0.87
- **μ€λ³΅ κ²μ¬ κ²°κ³Ό:** μ κ· μμ± (New discovery)
## π μ§μ κ·Έλν (Knowledge Graph)
- **μμ/루νΈ:** [[CSS Tutorial]]
- **κ΄λ ¨ κ°λ
:** [[CSS Pseudo-elements]], [[CSS Text Pseudo-elements]], [[CSS Lists]]
- **μ°Έμ‘° λ§₯λ½:** Referenced when inserting generated content or styling markers, selections, and dialog backdrops.
## π μΆμ² (Sources)
- [S1] W3Schools β CSS Content Pseudo-elements β https://www.w3schools.com/css/css_pseudo_elements_content.asp
## π λ³κ²½ μ΄λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Content Pseudo-elements" page (Astra wiki-curation, P-Reinforce v3.1 format).