--- id: css-text-pseudo-elements title: "CSS Text Pseudo-elements" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["::first-line", "::first-letter", "text pseudo-elements", "drop cap", "first line styling"] 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", "typography"] raw_sources: ["https://www.w3schools.com/css/css_pseudo_elements_text.asp"] applied_in: [] github_commit: "" --- # [[CSS Text Pseudo-elements]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The text pseudo-elements `::first-line` and `::first-letter` style just the opening line or opening letter of block-level text, and can be combined with classes and with each other. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`::first-line`** β€” styles the first line of text; can only be applied to block-level elements. [S1] - **`::first-letter`** β€” styles the first letter of text; can only be applied to block-level elements. [S1] - **Works with classes** β€” pseudo-elements can be combined with HTML classes (e.g. `p.intro::first-letter`). [S1] - **Combinable** β€” `::first-line` and `::first-letter` can both be applied to the same element. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Drop-cap pattern** β€” `::first-letter` with an enlarged font size produces a drop-cap-style opening letter. [S1] - **Class-scoped pseudo-element** β€” `selector.class::first-letter` limits the effect to a specific subset of elements. [S1] - **Stacking pseudo-elements** β€” applying both `::first-letter` and `::first-line` to one selector layers two styles on the same paragraph. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **The `::first-line` pseudo-element** [S1] The `::first-line` pseudo-element is used to style the first line of text. It can only be applied to block-level elements. ```css p::first-line { color: red; font-variant: small-caps; font-size: 19px; } ``` **The `::first-letter` pseudo-element** [S1] The `::first-letter` pseudo-element is used to style the first letter of text. Like `::first-line`, it can only be applied to block-level elements. ```css p::first-letter { color: red; font-size: xx-large; } ``` **Combining with a class** [S1] Pseudo-elements can be combined with HTML classes: ```css p.intro::first-letter { color: #ff0000; font-size: 200%; } ``` **Multiple pseudo-elements on one selector** [S1] Several pseudo-elements can be combined: ```css p::first-letter { color: red; font-size: xx-large; } p::first-line { color: blue; font-variant: small-caps; } ``` ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's applied examples are the red small-caps first line, the enlarged red first letter, the `.intro` class drop cap, and the stacked first-letter + first-line styling. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) First-line styling (language: CSS): ```css p::first-line { color: red; font-variant: small-caps; font-size: 19px; } ``` Drop-cap first letter (language: CSS): ```css p::first-letter { color: red; font-size: xx-large; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Content Pseudo-elements]], [[CSS Text]] - **μ°Έμ‘° λ§₯락:** Referenced when styling the opening line or letter of paragraphs, e.g. drop caps. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Text Pseudo-elements β€” https://www.w3schools.com/css/css_pseudo_elements_text.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Text Pseudo-elements" page (Astra wiki-curation, P-Reinforce v3.1 format).