--- 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).